5 pts.
 Window’s 2003 services
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?

Software/Hardware used:
ASKED: May 28, 2008  5:54 PM
UPDATED: May 29, 2008  1:21 AM

Answer Wiki:
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}!\.rootcimv2") 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>
Last Wiki Answer Submitted:  May 29, 2008  1:21 am  by  Labnuke99   32,645 pts.
All Answer Wiki Contributors:  Labnuke99   32,645 pts. , alessandro.panzetta   9,695 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _