http://dieseyer.de • all rights reserved • © 2011 v11.4

'*** v3.9 *** www.dieseyer.de *******************************
'
' Datei: wmi-listservices.vbs
' Autor: Janke , DTC
' Auf: www.dieseyer.de
'
' Listet alle Services eines Rechners.
'
' (Leicht angepasst von dieseyer.)
'
'************************************************************

Computername = WScript.CreateObject("WScript.Network").ComputerName

ComputerName = InputBox("Für welchen Rechner?", WScript.ScriptName, ComputerName )

If ComputerName = "" then WScript.Quit

winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//" & ComputerName

Set ServSet = GetObject( winmgmt1 ).InstancesOf("Win32_service")

LogDatei now()
LogDatei ComputerName & " - Liste aller laufenden Services: "


for each Serv in ServSet
GetObject("winmgmts:").InstancesOf ("win32_service")
Text = Serv.Description & vbCRLF
Text = Text & vbTab & " Executable: " & Serv.PathName & vbCRLF
Text = Text & vbTab & " Status: " & Serv.Status & vbCRLF
Text = Text & vbTab & " State: " & Serv.State & vbCRLF
Text = Text & vbTab & " Start Mode: " & Serv.StartMode & vbCRLF
Text = Text & vbTab & " Start Name: " & Serv.StartName & vbCRLF
LogDatei Text
' MsgBox Text, , WScript.ScriptName
next

LogDatei now()

LogDateiAnzeige

WScript.Quit


'*********************************
Sub LogDatei (LogTxt) ' v3.9
'*********************************
WScript.CreateObject("Scripting.FileSystemObject").OpenTextFile(WScript.ScriptName & ".log", 8, true).WriteLine (LogTxt)
End Sub ' LogDatei


'*********************************
Sub LogDateiAnzeige ' v3.9
'*********************************
WScript.CreateObject("WScript.Shell").run "notepad " & WScript.ScriptName & ".log"
End Sub ' LogDatei


http://dieseyer.de • all rights reserved • © 2011 v11.4