Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

utility to find the LogOn information of services 1

Status
Not open for further replies.

mlchris2

Technical User
Mar 18, 2005
512
US
Many services use the domain Administrator account on various servers in my network. I had plans to change the LogOn/RunAs for specific services and get away from running services/applications with the domain Administrator account. I need to change the password for this account, being my Jr SysAdmin is leaving.

Is there a utility that will list the services along with LogOn/RunAs information on a Win2k3 server???

Mark C.
 
Here is a vbscript that should help you, it will prompt you for the Server Name and it will put a csv file on your desktop of all the services on that machine with the Service account it is running under.

Code:
ForWriting = 2
strComputer = (InputBox("Enter Server Name"))
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set WSHShell = WScript.CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
Set fso = CreateObject ("Scripting.FileSystemObject")
Set fl = fso.CreateTextFile (DesktopPath & "\" & strComputer &"ServicesList.csv", ForWriting, True)
fl.writeLine "ServiceName" & vbtab & "ServiceAccountName"
Set colListOfServices = objWMIService.ExecQuery _
        ("Select * from Win32_Service")
For Each objService in colListOfServices
fl.writeLine objService.Name & vbtab & objService.StartName
Next
Wscript.Echo "Done"

If you aren't familiar with vbscript just copy and paste the code into notepad and save it with a file name with a .vbs file extension
 
THAT IS FREAKIN AWESOME. Exactly what I was lookin for. thanks.

Mark C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top