Created
January 30, 2018 14:44
-
-
Save bohack/5c9860ffac24599c3dc98da4d2760549 to your computer and use it in GitHub Desktop.
Get Total RAM from a PC via VBscript WMI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On Error Resume Next | |
Prefix ="fstu516" | |
For Count = 1 to 36 | |
Total = 0 | |
If Count < 10 then Fill="00" | |
If Count < 100 and Count > 9 then Fill="0" | |
strComputer = Prefix & Fill & Count | |
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") | |
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory") | |
For Each objItem in colItems | |
Total = abs(Total) + objItem.Capacity | |
Next | |
Wscript.Echo strComputer & " " & Total/1024 | |
Next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment