2

I use WMI Win32_VideoController, AdapterRAM property to read the display adapter RAM size in Windows 10, but the problem is that the value is limited to 4GB maximum.

On a display adapter with 11GB I still get 4GB (and yes I use int64 for the result, but the returned object contains 4GB even if inspected with the debugger).

Is there a way to get around this bug?

Mario
  • 13,941
  • 20
  • 54
  • 110

2 Answers2

2

Yes, check this POWERSHELL code out:

$qwMemorySize = (Get-ItemProperty -Path "HKLM:\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0*" -Name HardwareInformation.qwMemorySize -ErrorAction SilentlyContinue)."HardwareInformation.qwMemorySize"
foreach ($VRAM in $qwMemorySize)
{
    Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {$_.AdapterDACType -ne "Internal"} | ForEach-Object -Process {
        [PSCustomObject] @{
            Model      = $_.Caption
            "VRAM, GB" = [math]::round($VRAM/1GB)
        }
    }
}

Output:

Model                         VRAM, GB
-----                         --------
NVIDIA GeForce RTX 2070 SUPER        8
  • Thanks! It works. But the Class ID is always the same on all computers? – Mario Oct 22 '21 at 20:15
  • Yes according to this it appears stable https://learn.microsoft.com/en-us/windows-hardware/drivers/install/system-defined-device-setup-classes-available-to-vendors – Mgamerz Mar 13 '22 at 16:58
2

So, I've seen the same incorrect "solution" posted in several places. The script @samuel-kriikkula posted only works if you have a single graphics adapter. With more than one adapter, it loops through them incorrectly showing something like:

Model                                   VRAM
-----                                   ----
NVIDIA RTX A5500                 21464350720
NVIDIA RTX A4500                 21464350720
Microsoft Remote Display Adapter 21464350720
NVIDIA RTX A5500                 25757220864
NVIDIA RTX A4500                 25757220864
Microsoft Remote Display Adapter 25757220864

There's no need to poll CIM_VideoController, when the registry entry we already queried contains the adapter name. The following script works properly to gather graphics memory details for every installed adapter.

$adapterMemory = (Get-ItemProperty -Path "HKLM:\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0*" -Name "HardwareInformation.AdapterString", "HardwareInformation.qwMemorySize" -Exclude PSPath -ErrorAction SilentlyContinue)

foreach ($adapter in $adapterMemory) {
  [PSCustomObject] @{
    Model=$adapter."HardwareInformation.AdapterString"
    "VRAM (GB)"=[math]::round($adapter."HardwareInformation.qwMemorySize"/1GB)
  }
}

This results in the following output:

Model            VRAM (GB)
-----            ---------
NVIDIA RTX A4500        20
NVIDIA RTX A5500        24
sysrage
  • 594
  • 4
  • 6