WIN2K无法运行WMI
请教各位大老:为什么WMI在WIN2K下无法运行,WMI-SDK 1.50(wmicore.EXE)在WIN2K下也无法安装,WIN2K中的Windows Management Instrumentation和Windows Management Instrumentation Driver Extensions服务都已经启动????Func _GetMemorySize()
Local $PhysicalMemory = " "
Local $colItems, $objWMIService, $objItem
Local $wbemFlagReturnImmediately = 0x10 , $wbemFlagForwardOnly = 0x20
$objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) Then
For $objPhysicalMemory In $colItems
$PhysicalMemory = $objPhysicalMemory.Capacity
If $PhysicalMemory = " " Then ExitLoop
Return Int($PhysicalMemory / (1024 * 1024)) & " MBytes"
Next
EndIf
Return "Unknown"
EndFunc 你所附函数在虚拟机Win2K Server SP4测试通过,请检查你的操作系统。
注意,Win32_PhysicalMemory获取的是每个插槽上的单条物理内存容量。例如,某电脑上插了3条1G内存(共3G),但_GetMemorySize()将返回1G。请确认这是否你所希望的。
如果你需要返回物理内存总数,请使用Win32_ComputerSystem里的TotalPhysicalMemory,或者直接用au3内置函数MemGetStats。 实在感谢,谢谢你的提醒!!!!
我在Windows 2000 PRO SP4里无法运行,还在郁闷中!!!!!!
页:
[1]