Hi,
mein Windows ist seit geraumer Zeit eine Baustelle..
..nach einer erforderlichen und geplanten NeuInstallation habe ich es noch nicht
wieder so hinbekommen, wie es vorher war..
Jedenfalls ist im Zuge dieser Arbeiten ein Skript entstanden, das mir einen ganz
guten Überblick über alle meine Windows-Dienste verschaffte.
Nachdem ich das neueste AutoIt samt allem Zubehör jetzt auch wieder ans Laufen
bekommen habe, möchte ich es dem Forum nicht vorenthalten
Ich habe extra nicht alle überflüssigen Zeilen gelöscht, damit jemand beim
Herumbasteln am Skript nicht soviel Mühe hat
Spoiler anzeigen
Code
; Erstellt von AutoIt Scriptomatic
Dim $i, $m, $Manual, $Auto, $Disabled, $Stopped, $Running
$wbemFlagReturnImmediately=0x10
$wbemFlagForwardOnly=0x20
$colItems=""
$strComputer=@ComputerName
$s="<table cellspacing=0 colspacing=0 border=1>"
$s&="<tr><th colspan=6 align=left><fontcolor=navy>Computer: " &$strComputer &"</td></tr>"
$objWMIService=ObjGet("winmgmts:\\" &$strComputer &"\root\CIMV2")
$colItems=$objWMIService.ExecQuery("SELECT * FROM Win32_Service", "WQL", _
$wbemFlagReturnImmediately+$wbemFlagForwardOnly)
If IsObj($colItems) Then
$s&="<tr><th>lfd.</th><th>ServiceName</th><th>ProcessId</th><th>StartMode</th><th>State</td></tr>"
For $objItem In $colItems
With $objItem
$i+=1
$s&="<tr><td align=right><b><font color=red>" &$i &"</td>"
$s&="<td title=" &Chr(34) &"Display_Name:" &.DisplayName &@Lf &"Caption:" &.Caption &@Lf &StringReplace(.Description, Chr(34), "'") &Chr(34) &"><b>" &.Name &"</td>"
; $s&=AppendLn(.AcceptPause)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.AcceptStop)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.Caption)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.CheckPoint)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.CreationClassName)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.Description)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.DesktopInteract)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.DisplayName)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.ErrorControl)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.ExitCode)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(WMIDateStringToDate(.InstallDate))"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.InstallDate)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.PathName)"<td>" &$Inhalt &"</td>"
$t=.ProcessId
If $t=0 Then $t=" "
$s&="<td>" &.ProcessId &"</td>"
; $s&=AppendLn(".ServiceSpecificExitCode)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.ServiceType)"<td>" &$Inhalt &"</td>"
; $s&="<td>" &.Started &"</td>"
$s&="<td>" &.StartMode &"</td>"
; $s&=AppendLn(.StartName)"<td>" &$Inhalt &"</td>"
$s&="<td>" &.State &"</td>"
; $s&=AppendLn(.Status)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.SystemCreationClassName)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.SystemName)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.TagId)"<td>" &$Inhalt &"</td>"
; $s&=AppendLn(.WaitHint)"<td>" &$Inhalt &"</td>"
; If Msgbox(1, "WMI-Ausgabe", $s)=2 then ExitLoop
$s&="</tr>"
$Manual+=(.StartMode="Manual")*1
$Auto+=(.StartMode="Auto")*1
$Disabled+=(.StartMode="Disabled")*1
$Stopped+=(.State="Stopped")*1
$Running+=(.State="Running")*1
EndWith
Next
$s&="<tr><td colspan=9>Auto=" &$Auto &", Manual=" &$Manual &", Disabled=" &$Disabled &", Stopped=" &$Stopped &", Running=" &$Running &"</td></tr>"
_IEPrt($s, "Service-Details")
Else
Msgbox(0, "WMI-Ausgabe", "Keine WMI-Objekte gefunden für Klasse: " &"Win32_Service")
Endif
Func _IEPrt($Was, $Titel, $Breite=660, $Hoehe=300, $Links=100, $Oben=100)
Dim $IE=ObjCreate("InternetExplorer.Application.1")
$IE.Navigate("about:blank")
$IE.Document.Title=$Titel
$IE.Left=$Links
$IE.Top=$Oben
$IE.Width=$Breite
$IE.Height=$Hoehe
$IE.Visible=True
$IE.Document.Body.InnerHtml="Bitte warten.."
$IE.Toolbar=False
$IE.Menubar=False
$IE.Statusbar=False
$IE.Document.Body.InnerHtml=$Was
EndFunc
Func WMIDateStringToDate($dtmDate)
Return (StringMid($dtmDate, 5, 2) &"/" &StringMid($dtmDate, 7, 2) &"/" &StringLeft($dtmDate, 4) &" " &StringMid($dtmDate, 9, 2) &":" &StringMid($dtmDate, 11, 2) &":" &StringMid($dtmDate,13, 2))
EndFunc
Alles anzeigen
Möge es auch Anderen nützen..
Gruß
ytwinky