Win32_LogicalMemoryConfiguration在win7下无法使用

  

strComputer=?”

  

设置objSWbemServices=GetObject (“winmgmts: \“;,strComputer)
设置colSWbemObjectSet=_
objSWbemServices.InstancesOf (“Win32_LogicalMemoryConfiguration")

  

每objSWbemObject colSWbemObjectSet
Wscript。回声“总物理内存(kb):“,_
objSWbemObject.TotalPhysicalMemory下

这段代码在win7下无法运行报错(null): 0 x80041010在win2003下可以运行,win7下已经取消Win32 LogicalMemoryConfiguration类
以下是替代方法
strComputer=?”
设置objWMIService=GetObject (“winmgmts: \“;,strComputer,“\根\ CIMV2")
设置colItems=objWMIService。ExecQuery (

“SELECT * FROM Win32_PhysicalMemory",, 48)
每objItem colItems
Wscript。回声“- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -产生绯闻。
Wscript。回声“Win32_PhysicalMemory instance"
Wscript。回声“- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -产生绯闻。
Wscript。回声“能力:“,objItem。容量下

用Win32_PhysicalMemory实例代替之

Win32_LogicalMemoryConfiguration在win7下无法使用