Search code examples
c#wmiwmi-query

WMI Win32_VideoController RAM 4GB Limit


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?


Solution

  • 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