How do I get total physical memory size using PowerShell without WMI?

后端 未结 8 1826
暖寄归人
暖寄归人 2020-12-31 04:12

I\'m trying to get the physical memory size using PowerShell, but without using get-wmiobject.

I have been using the following PS cmdlet to get the physical memory s

8条回答
  •  Happy的楠姐
    2020-12-31 04:45

    Id like to say that instead of going with the systeminfo this would help over to get the total physical memory in GB's the machine

    Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum | Foreach {"{0:N2}" -f ([math]::round(($_.Sum / 1GB),2))}
    

    you can pass this value to the variable and get the gross output for the total physical memory in the machine

       $totalmemory = Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum | Foreach {"{0:N2}" -f ([math]::round(($_.Sum / 1GB),2))}
       $totalmemory
    

提交回复
热议问题