回复 17# _ddqs.
看下这样获取正确吗?如果不正确,请检查下WMI服务打开正常吗?
#include <array.au3>
$x=getmem()
_ArrayDisplay($x)
Func getmem()
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output=""
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
Local $mem[1][2],$k=1
For $objItem In $colItems
ReDim $mem[$k+1][2]
$output=Execute($objItem.Capacity)
$mem[$k][0]=$objItem.BankLabel
$mem[$k][1]=$output
$k+=1
Next
$mem[0][0]=UBound($mem)-1
Return $mem
Else
Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_PhysicalMemory" )
Endif
EndFunc
|