One more question and I'll leave everyone alone for the rest of the day -- I promise! Besides, I'm already rooting for everyone who posts answers to my questions today to have their kixtart.org salaries doubled.

I'm trying to enumerate all running services on a server from a local logon. Again, we're talking NT4, 2K, and 2K3 servers.

I guess I could pipe and massage the output of "net start" to get what I want. Any other suggestions? I'd prefer to get shortnames if possible.

Thanks,

NMM

P.S. FWIW, M$ has a VBScript method that seems needlessly complex. I wanted to get your suggestions before trying to translate this. I'm not even sure if the dictionary object is supported under KiXtart.

(Formatted as found)
Code:
 
set objIdDictionary = CreateObject("Scripting.Dictionary")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServices = objWMIService.ExecQuery _
("Select * from Win32_Service Where State <> 'Stopped'")
For Each objService in colServices
If objIdDictionary.Exists(objService.ProcessID) Then
Else
objIdDictionary.Add objService.ProcessID, objService.ProcessID
End If
Next
colProcessIDs = objIdDictionary.Items
For i = 0 to objIdDictionary.Count - 1
Set colServices = objWMIService.ExecQuery _
("Select * from Win32_Service Where ProcessID = '" & _
colProcessIDs(i) & "'")
Wscript.Echo "Process ID: " & colProcessIDs(i)
For Each objService in colServices
Wscript.Echo VbTab & objService.DisplayName
Next
Next