Show status of a Windows service from the command prompt

Is there any Windows command which will show the status of a single service?

For example, I want to know whether "IIS admin service" is running or not. If it is running the command ouput should be "running".

I tried sc query type= service state= all | find "IIS Admin Service" which displayed the output:

"DISPLAY_NAME: IIS Admin Service"

I also tried net start "IIS Admin Service" | find "Running" which displays:

The requested service has already been started.

More help is available by typing NET HELPMSG 2182.

But it doesn't give me an output such as

"service name" = running / disabled / stopped

Is there a command which has output in this format?


Solution 1:

Use the service name and not the display name

sc query iisadmin

Solution 2:

You can use Powershell thus:

Get-Service -name 'IIS Admin Service'