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