Find actual total physical memory WMI or registry?
#1
Posted 14 August 2012 - 10:44 AM
1 - 4.00 GB is reported as "Installed memory" on Computer Properties
2 - 2.43 GB usable in the same place, also matches Task Manager's Performance tab of 2492 Total Physical Memory.
I want to get this 4GB value that I see in Computer Properties, but all I can find is the lower number. Examples:
Win32_ComputerSystem: TotalPhysicalMemory = 2613805056
Win32_OperatingSystem: TotalVisibleMemorySize = 2552544
Win32_PhysicalMemory: Capacity = 2147483648
Win32_PhysicalMemory: Round(Capacity / (1024^2)) = 2048
The only thing close I can find is Win32_MemoryArray (or MemoryDevice): EndingAddress = 4194303.
That is presuming that number is showing me the RAM address. I tested on a 1GB system and it returns a 1xxxxxx value.
So where can I get the Installed Memory size data from?
#2
Posted 14 August 2012 - 11:11 AM
...and thanks for the REG entries.
#3
Posted 14 August 2012 - 11:28 AM
Round ( EndingAddress / (1024^2))
Gives me "4" on a 4GB PC and "8" on an 8GB PC. This might just be the thing to use.
#4
Posted 14 August 2012 - 11:54 AM
Glad to assist... and again - thanks!
#5
Posted 14 August 2012 - 12:37 PM
Example WMI ComputerSystem Class
Const GB = 1073741824
Const MB = 1048576
Dim Obj, Wmi
Set Wmi = GetObject("winmgmts:\\.\root\CIMV2")
For Each Obj In Wmi.ExecQuery("SELECT * FROM Win32_ComputerSystem")
If Obj.TotalPhysicalMemory > Int(GB) Then
msgbox _
"Total Physical Memory : " & FormatNumber(Obj.TotalPhysicalMemory / GB,2) & " GB"
Else
msgbox _
"Total Physical Memory : " & FormatNumber(Obj.TotalPhysicalMemory / MB,2) & " MB"
End If
Nex
#6
Posted 15 August 2012 - 08:43 AM
#7
Posted 15 August 2012 - 12:43 PM
Quote
---------------------------
Total Physical Memory : 8.00 GB
---------------------------
OK
---------------------------
So it says I have 8 gigs of ram installed, the exact amount I have on my machine. 4 x 2 GB Ram sticks installed on my machine.
Quote
So what your saying
Example
I have a video card that uses 1 GIG of ram and I have 8 gigs you expect this WMI Class to subtract 1 GIG of ram and say you have only 7 gigs.
That would give a incorrect amount of installed ram 7 GIGS.
The question ask was TOTAL INSTALL RAM not figure out ram after video card usage, usable ram on a 32 bit OS. This WMI Class give
what ever amount of working RAM sticks that are plug into the RAM Slots.
#8
Posted 15 August 2012 - 01:02 PM
Win32_ComputerSystem: TotalPhysicalMemory = 2613805056 / 1073741824 = 2.434295654296875 GB
Win32_ComputerSystem: TotalPhysicalMemory = 2613805056 / 1048576 = 2492.71875 MB
Task Manager values for Physical Memory (MB)
Total: 2492
It is only a guess for me that my missing ~708MB RAM (3.200GB - 2.492GB) is due to the video card.
I do not know why your WMI query works for you but mine does not.
#9
Posted 15 August 2012 - 04:42 PM
had approx 3.25 GB of 8 GB usable ram. Maybe the Wmi is reading what is left over as the amount
of Ram minus the Video Card Usage.
#10
Posted 24 April 2013 - 07:17 AM
GlobalMemoryStatus() works on any 32-bit Windows. It can show a maximum of 4GB.
GlobalMemoryStatusEx() works on XP and later, both 32-bit and 64-bit.
More info at MSDN.
Here's a small utility developed by myself in AutoHotkey, that shows amount of RAM, swap file and total load, using GlobalMemoryStatus() :
MemPanel 1.0.1.0

(added screenshot)
This post has been edited by Drugwash: 24 April 2013 - 11:19 AM
#11
Posted 24 April 2013 - 10:18 AM
If you wanted to know the installed memory then perhaps using GetPhysicallyInstalledSystemMemory, (Win Vista+) will do what you want.
For simple scripting the following should show you what's installed in your RAM slots:
WMIC MEMORYCHIP GET capacity, devicelocator
Get-WmiObject CIM_PhysicalMemory | select capacity,devicelocator | ft -AutoSize
#12
Posted 24 April 2013 - 11:06 AM
Yzöwl, on 24 April 2013 - 10:18 AM, said:
Relevant info is retrieved from a struct and yes, some values in certain fields will differ, such as free memory, system load, etc. But the amount of physically installed memory should have no reason to differ between calls, unless there's a bug in the API and even that might exist or not according to the OS version running.
I've developed the above application under and mainly for 98SE, therefore I had to use the simple version of the API, not the extended one. For any 32-bit Windows it should work fine. Of course, 64-bit Windows that can accept more than 4GB of RAM should use the extended version of the API instead, for an accurate result.
I could build a x64-compatible version of the application but I have no x64 system to test it on.
#13
Posted 24 April 2013 - 11:39 AM
GsmBasicInfo.png (34K)
Number of downloads: 3
This is from this Thread
Get_KeyV1.exe
- ← How to merge two text files?
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- Need help with Windows batch file script →



Help
Back to top










