The WMI Service object on windows is very powerful, it allows us to list memory devices easily by retrieving information via query, which looks like SQL. The query to list memory devices is:
Select * from Win32_MemoryDevice
With VBScript, the code snippet is:
' List Memory Devices
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_MemoryDevice")
For Each objItem in colItems
Wscript.Echo "Device ID: " & objItem.DeviceID
Wscript.Echo "Ending Address: " & objItem.EndingAddress
Wscript.Echo "Starting Address: " & objItem.StartingAddress
Wscript.Echo
Next
On my Lenovo M900 Workstation, the results are (32GB RAM).
Device ID: Memory Device 0
Ending Address: 8388607
Starting Address: 0
Device ID: Memory Device 1
Ending Address: 25165823
Starting Address: 16777216
Device ID: Memory Device 2
Ending Address: 16777215
Starting Address: 8388608
Device ID: Memory Device 3
Ending Address: 33554431
Starting Address: 25165824
Of course, you can also do the same in Microsoft JScript (as long as it runs under Windows Scripting Host) or other scripting languages.
–EOF (The Ultimate Computing & Technology Blog) —
237 wordsLast Post: How to List Installed Hot Fixes using VBScript on Windows Platforms?
Next Post: How to List Keyboard Properties using VBScript and WMI Object?