Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Win32_LogicalMemoryConfiguration cannot be used under win7

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

StrComputer = "."

Set objSWbemServices = GetObject ("winmgmts:\" & strComputer)

Set colSWbemObjectSet = _

ObjSWbemServices.InstancesOf ("Win32_LogicalMemoryConfiguration")

For Each objSWbemObject In colSWbemObjectSet

Wscript.Echo "Total Physical Memory (kb):" & _

ObjSWbemObject.TotalPhysicalMemory

Next

This code cannot run under win7 (null): 0x80041010 can be run under win2003, and Win32LogicalMemoryConfiguration class has been cancelled under win7.

Here are the alternatives

StrComputer = "."

Set objWMIService = GetObject ("winmgmts:\" & strComputer & "\ root\ CIMV2")

Set colItems = objWMIService.ExecQuery (

"SELECT * FROM Win32_PhysicalMemory", 48)

For Each objItem in colItems

Wscript.Echo "-"

Wscript.Echo "Win32_PhysicalMemory instance"

Wscript.Echo "-"

Wscript.Echo "Capacity:" & objItem.Capacity

Next

Replace it with Win32_PhysicalMemory instance

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report