List Service Properties in Windows

You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.


Description

List Service Properties in Windows using VBScript, WMI and LDAP

Example(s)

Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.OpenTextFile("c:\scripts\service_list.csv", _ 
    ForAppending, True)

objLogFile.Write _
    ("System Name,Service Name,Service Type,Service State, Exit " _ 
        & "Code,Process ID,Can Be Paused,Can Be Stopped,Caption," _ 
        & "Description,Can Interact with Desktop,Display Name,Error " _
        & "Control, Executable Path Name,Service Started," _ 
        & "Start Mode,Account Name ") 
objLogFile.Writeline

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colListOfServices = objWMIService.ExecQuery _
        ("Select * from Win32_Service")

For Each objService in colListOfServices
    objLogFile.Write(objService.SystemName) & "," 
    objLogFile.Write(objService.Name) & "," 
    objLogFile.Write(objService.ServiceType) & "," 
    objLogFile.Write(objService.State) & "," 
    objLogFile.Write(objService.ExitCode) & "," 
    objLogFile.Write(objService.ProcessID) & "," 
    objLogFile.Write(objService.AcceptPause) & "," 
    objLogFile.Write(objService.AcceptStop) & "," 
    objLogFile.Write(objService.Caption) & "," 
    objLogFile.Write(objService.Description) & "," 
    objLogFile.Write(objService.DesktopInteract) & "," 
    objLogFile.Write(objService.DisplayName) & "," 
    objLogFile.Write(objService.ErrorControl) & "," 
    objLogFile.Write(objService.PathName) & "," 
    objLogFile.Write(objService.Started) & "," 
    objLogFile.Write(objService.StartMode) & "," 
    objLogFile.Write(objService.StartName) & "," 
    objLogFile.writeline
Next
objLogFile.Close