Windows 2003 services

5 pts.
Microsoft Windows Server 2003
I am an auditor and trying to create a script that will gather the service's and there status and start up types for windows server 2003. Is there a way to gather this information without bogging the server down within a script?

Answer Wiki

Thanks. We'll let you know when a new response is added.

sure you can do this, hereafter an example of code that will save results to a tab separated file (Services_Status.tsv):

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("Services_Status.tsv")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service")
For Each objService in colRunningServices
objFile.WriteLine objService.DisplayName & VbTab & objService.State & vbTab & objService.StartMode


An even easier way would be using the psservice.exe application from Microsoft.

PsService v2.21 – Service information and configuration utility
Copyright (C) 2001-2006 Mark Russinovich
Sysinternals –

PsService lists or controls services on a local or remote system.

Usage: psservice [\\Computer [-u Username [-p Password]]] <cmd> <optns>
Cmd is one of the following:
query Queries the status of a service
config Queries the configuration
setconfig Sets the configuration
start Starts a service
stop Stops a service
restart Stops and then restarts a service
pause Pauses a service
cont Continues a paused service
depend Enumerates the services that depend on the one specified
find Searches for an instance of a service on the network
security Reports the security permissions assigned to a service
Use the username and password to log into the remote computer in cases where
your account does not have permissions to perform the action you specify.

Omitting a command queries the active services on the specified computer.
Enter -? for help on a particular command.

You can also use the sc command from the command prompt.

sc \\ServerName query

Discuss This Question:  

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: