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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to enumerate AD services 1

Status
Not open for further replies.

getndz

IS-IT--Management
Jul 25, 2007
162
CH
Hello,

We must modify the Domain Admin password.
Now some services on the servers run with the Admin Account, how can I find out the services running with that account ?
(xls document, ....)

Thank You
getndz
 
I didnt write this, not sure who did either. I found this with google some time ago when i had a simular issue. Copy the code into a file called EnumServices.vbs or whatever you want to call it. Then in the same path as the .vbs file create a file called Servers.txt, in this file list each server by name you want enumerated, one per line. Execute the .vbs file, it will output server name, service, and service account to a cvs file which you can then sort and filter.

Code:
Option Explicit

Const filInputName = "Servers.txt"
Const filOutputName = "Service Info.csv"

Dim objDomain, fso, filInput, filOutput, strComputer, objComputer, objService

Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Set filInput = fso.OpenTextFile(filInputName)
Set filOutput = fso.CreateTextFile(filOutputName)

filOutput.WriteLine "Server,Service,Service Account"
Do Until filInput.AtEndOfStream
    strComputer = filInput.ReadLine
    Set objComputer = GetObject("WinNT://" & strComputer)
    objComputer.Filter = Array("Service")
    For Each objService in objComputer
        filOutput.WriteLine strComputer & "," & objService.DisplayName & "," & objService.ServiceAccountName
    Next
    filOutput.WriteLine
Loop

MsgBox "All computers specified in the " & filInputName & " file have been scanned.", vbInformation, "Execution Completed"

Set objDomain = Nothing
Set fso = Nothing
Set filInput = Nothing
Set objComputer = Nothing
Set objService = Nothing


RoadKi11

"This apparent fear reaction is typical, rather than try to solve technical problems technically, policy solutions are often chosen." - Fred Cohen
 
I would advise (as I am sure many others would too) that you do not use the Admin account for services but instead you use a separate (service) account which has the permissions it requires to run the service.

--------------------------------------
"Insert funny comment in here!"
--------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top