Question

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

Était-ce utile?

La solution

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.

Autres conseils

    $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} in Powershell.exe

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top