command line question

G

Guest

I know you can use the "NET START" command to display a list of every service
running on a machine but does anyone know how I can list these services and
the "LOG ON AS" column?

Thanks,
Tony
 
P

Pegasus \(MVP\)

Tony said:
I know you can use the "NET START" command to display a list of every service
running on a machine but does anyone know how I can list these services and
the "LOG ON AS" column?

Thanks,
Tony

You have to extract it from the registry, e.g. from
HKLM\SYSTEM\CurrentControlSet\Services\winvnc\Objectname.
 
T

Torgeir Bakken \(MVP\)

Tony said:
I know you can use the "NET START" command to display a list of
every service running on a machine but does anyone know how I
can list these services and the "LOG ON AS" column?
Hi,

Running the following command:
sc.exe qc [service name]

will list the logon account in the SERVICE_START_NAME attribute.

If you are using Windows 2000 and not Windows XP, note that SC.exe
doesn't come builtin with Windows 2000. You can download it from here:
ftp://ftp.microsoft.com/reskit/win2000/

Note that you need to use the service name, and not the display name
(if they are different). "NET START" lists the display names of the
services.

So this will not work:
sc.exe query "Print Spooler"

but this will:
sc.exe qc Spooler


Example output for the "Print Spooler" service:

C:\>sc.exe qc Spooler
[SC] GetServiceConfig SUCCESS

SERVICE_NAME: Spooler
TYPE : 110 WIN32_OWN_PROCESS (interactive)
START_TYPE : 2 AUTO_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : C:\WINNT\system32\spoolsv.exe
LOAD_ORDER_GROUP : SpoolerGroup
TAG : 0
DISPLAY_NAME : Print Spooler
DEPENDENCIES : RPCSS
SERVICE_START_NAME : LocalSystem
 
P

Pegasus \(MVP\)

Torgeir Bakken (MVP) said:
Tony said:
I know you can use the "NET START" command to display a list of
every service running on a machine but does anyone know how I
can list these services and the "LOG ON AS" column?
Hi,

Running the following command:
sc.exe qc [service name]

will list the logon account in the SERVICE_START_NAME attribute.

If you are using Windows 2000 and not Windows XP, note that SC.exe
doesn't come builtin with Windows 2000. You can download it from here:
ftp://ftp.microsoft.com/reskit/win2000/

Note that you need to use the service name, and not the display name
(if they are different). "NET START" lists the display names of the
services.

So this will not work:
sc.exe query "Print Spooler"

but this will:
sc.exe qc Spooler


Example output for the "Print Spooler" service:

C:\>sc.exe qc Spooler
[SC] GetServiceConfig SUCCESS

SERVICE_NAME: Spooler
TYPE : 110 WIN32_OWN_PROCESS (interactive)
START_TYPE : 2 AUTO_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : C:\WINNT\system32\spoolsv.exe
LOAD_ORDER_GROUP : SpoolerGroup
TAG : 0
DISPLAY_NAME : Print Spooler
DEPENDENCIES : RPCSS
SERVICE_START_NAME : LocalSystem





--
torgeir, Microsoft MVP Scripting, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Nice one - I learnt something new today!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top