How to find the maximum RAM a computer can be extended upto in powershell. I tried using
$colItems3 = get-wmiobject -class "Win32_OperatingSystem"
but the answer is not correct
For installed RAM you want:
Get-WmiObject Win32_PhysicalMemory | Where {$_.MemoryType -ge 20} |
Measure Capacity -sum
Look at this MSDN page for more info on MemoryType.
For the MAX amount of RAM the system will handle, I think this is supposed to get you that. However, I don't think that means the OS or the motherboard would necessarily handle that much memory. I see nothing on the Win32_MotherboardDevice that shows max RAM.
Get-WmiObject Win32_PhysicalMemoryArray | Where {$_.Use -eq 3} |
Foreach {($_.MaxCapacity*1KB)/1GB}
Here's the MSDN page for Win32_PhysicalMemoryArray .
$colItems3 = get-wmiobject -class "win32_PhysicalMemoryArray" -computername $strComputer
foreach ($objItem3 in $colItems3)
{
$e3=($colItems3.MemoryDevices)* 2
write-host "Free Physical Memory : " $e3 'GB'
}
This is not correct but atleast near one
Try: gwmi Win32_OperatingSystem | % {$_.MaxProcessMemorySize / 1MB}
gwmi Win32_OperatingSystem | % {$_.MaxProcessMemorySize / 1MB}
in Powershell.exe
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.