farag2/PC-information

vram question

FZKiritsugu opened this issue · 15 comments

can it get vram if above 4gb? for example if i have a 6gb vram does it print it?

It displayed my 6 GB. What's the problem to run? :)

i was asking because i don't have a 6gb vram, and for example with c# using Win32_VideoController will output the correct information only if vram is less than 4.3gb

Ah, I got it. Yes, this code works. I didn't take from StackOverflow, for example. I coded it by myself dor my own purposes, and shared it with the community. So it works. At least it worked on 2060 Super 1,5 years ago.:)

photo_2021-07-04_22-52-53

Tested on my friend's PC now.

big thanks from me! looks like it's working, i will send the script to a friend, he has good gpu and see if it also works.

hey, tried it and gave this error:

Method invocation failed because [System.Object[]] does not contain a method named 'op_Division'.
At line:1 char:1

  • $VRAM = $qwMemorySize/1GB

is that because he has 2gpus? 2070 and 970

Hm... I did not have the opportunity to test on double GPUs system. I can fix it only by having a remote access to his PC.
But why he wants to get VRam via CLI?

for a project, it gives a list back for him, so something like :

foreach ($vram in $qwMemorySize) {
$VRAM = [math]::round($vram/1GB)
echo "VRAM = $VRAM"
}

worked

Really? I'll send you an edited version tomorrow.

thank you so much!

if ((Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {$_.AdapterDACType -ne "Internal"}))
{
	$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)
			}
		}
	}
}

Works?

yes! works perfectly! thank you so much! do you know if this works with amd graphic cards as well?

Hadn't a chance to test. Everyone has NVidia one around me. :) But I think it sbould: the key is general

oh, if the registry key is the same then it will work, also a really nice easy way of getting vram, didn't know that a reg key hold vram..

Nobody knew it. I had to make a research by myself)