On Error Resume Next
InputFile = ("c:\computers.txt")
OutputFile = ("c:\result.txt")
Service = ("netlogon")
Set oFS = CreateObject("Scripting.FileSystemObject")
Set f = oFS.OpenTextFile(InputFile)
Set fr = oFS.CreateTextFile(OutputFile, True)
Computers = f.ReadAll
f.Close
arrComputers = Split(Computers, vbCrLf)
fr.WriteLine("Server" & vbTab & "Services" & vbTab & "State")
For Each strComputer in arrComputers
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service")
For Each objService in colRunningServices
If objService.DisplayName = Service Then
fr.WriteLine(strComputer & vbTab & objService.DisplayName & vbTab & objService.State)
End If
Next
Next
MsgBox "Service gathering complete", 0, "Info"