Window’s 2003 services

5 pts.
Tags:
Auditing
Audits
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.

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

<pre>
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
Next
objFile.Close
WScript.Quit(0)
</pre>

Bye

———————————————–
An even easier way would be using the <a href=”http://technet.microsoft.com/en-us/sysinternals/bb897542.aspx”>psservice.exe</a> application from Microsoft.

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

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.

<pre>sc \\ServerName query</pre>

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following