VBS – Installed RAM

The below snippet of vbs is used to query WMI for the amount of ram installed on a pc. For a remote device, change strComputer to the hostname of the target computer.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings 
 Wscript.Echo "System Name: " & objComputer.Name
 Wscript.Echo "Total Physical Memory: " & objComputer.TotalPhysicalMemory
Next

Taken from: https://msdn.microsoft.com/en-us/library/aa394587(v=vs.85).aspx

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.