2# xxxlll2007
像這樣嗎?; 生成于 AutoIt Scriptomatic
#include <Array.au3>
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output=""
$Output = $Output & "Computer: " & $strComputer & @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Service", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
Dim $Array[1] = ["WMI Test"]
If IsObj($colItems) then
For $objItem In $colItems
;$Output = $Output & "DisplayName: " & $objItem.DisplayName
;$Output = $Output & "PathName: " & $objItem.PathName
;$Output = $Output & "StartMode: " & $objItem.StartMode
;$Output = $Output & "StartName: " & $objItem.StartName
;$Output = $Output & "State: " & $objItem.State
;$Output = $Output & "Status: " & $objItem.Status
;$Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName
;$Output = $Output & "SystemName: " & $objItem.SystemName
;if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
;$Output=""
_ArrayAdd($Array, $objItem.DisplayName)
_ArrayAdd($Array, $objItem.PathName)
_ArrayAdd($Array, $objItem.StartMode)
_ArrayAdd($Array, $objItem.StartName)
_ArrayAdd($Array, $objItem.State)
_ArrayAdd($Array, $objItem.Status)
_ArrayAdd($Array, $objItem.SystemCreationClassName)
_ArrayAdd($Array, $objItem.SystemName)
_ArrayDisplay($Array, "$Array")
ExitLoop
Next
Else
Msgbox(0,"WMI ?出","No WMI Objects Found for class: " & "Win32_Service" )
Endif
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
|