I need to run a command line check to see if a service is stopped, and if it is, start it. I can not just start it because then I get a bad resultcode and the SCCM task sequence I need it for fails.
Here's what I thought should've done the trick but didn't:
IF NOT ('sc query "bits"^| find "RUNNING"')=="" sc start "bits"
The error I get is: query was unexpected at this time.
I'd like to do this in a single line.