« HOWTO: Remotely set permissions for a Windows ServiceHOWTO: Remove Windows Logon Wallpaper »

HOWTO: Remotely Query Windows Service Information

07/14/07

Permalink 08:31:48 pm by guy, Categories: Windows

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:
Y:\>sc \\2qds941 qc MyService
[SC] GetServiceConfig SUCCESS

SERVICE_NAME: MyService
TYPE : 10 WIN32_OWN_PROCESS
START_TYPE : 2 AUTO_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : "C:\MyService\MySerice.exe"
LOAD_ORDER_GROUP :
TAG : 0
DISPLAY_NAME : MyService
DEPENDENCIES : MSMQ
SERVICE_START_NAME : vssi\ece

1 comment

Comment from: Spike [Visitor] · http://dosadi.com
Thanks, just what I needed! Seems to work fine on Vista too.
07/01/09 @ 00:11

Comments are closed for this post.

October 2014
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
I'm a generalist, at least if I'm honest. In my job I am primarily a developer, but also a sysadmin, and (as little as possible) technical support. I know a little about a lot of things, a lot about some things, and everything about nothing. Here I will post random learnings...

Search

XML Feeds

User tools

blogging software