I often need to query Windows Service info, and often I don’t want to log into the client or server machine to do my work. Luckily the Windows SC command (I’m not sure how far back in the Windows OS history this exists, but I know it is available in XP and 2003) works both locally and remotely. Below are some examples.
This procedure will show you how to query information about a a Windows Service.
The command can be run locally or be pointed to a remote machine for which you have admin privs.
Get a list of Services that are running:
Y:/>sc //2qds941 query type= service | find "SERVICE_NAME"
SERVICE_NAME: AudioSrv
SERVICE_NAME: Automatic LiveUpdate Scheduler
SERVICE_NAME: BESClient
SERVICE_NAME: CactusXMBService
SERVICE_NAME: ccEvtMgr
SERVICE_NAME: ccProxy
SERVICE_NAME: ccSetMgr
Follow up:
Get a list of Services that are not running:
Y:/>sc //2qds941 query type= service state= inactive | find "SERVICE_NAME"
SERVICE_NAME: Alerter
SERVICE_NAME: ALG
SERVICE_NAME: AppMgmt
SERVICE_NAME: aspnet_state
SERVICE_NAME: BITS
SERVICE_NAME: Browser
…
Get a list of all Services:
Y:/>sc //2qds941 query type= service state= all | find "SERVICE_NAME"
SERVICE_NAME: Alerter
SERVICE_NAME: ALG
SERVICE_NAME: AppMgmt
SERVICE_NAME: aspnet_state
SERVICE_NAME: AudioSrv
SERVICE_NAME: Automatic LiveUpdate Scheduler
SERVICE_NAME: BESClient
…
Get a more detailed list of all Services:
Y:/>sc //2qds941 query type= service state= all | find /V "0x"
SERVICE_NAME: Alerter
DISPLAY_NAME: Alerter
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 1 STOPPED
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
SERVICE_NAME: ALG
DISPLAY_NAME: Application Layer Gateway Service
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
SERVICE_NAME: AppMgmt
DISPLAY_NAME: Application Management
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 1 STOPPED
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
…
Get detailed information on the configuration of specified service: