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

后端 未结 8 1780
暖寄归人
暖寄归人 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条回答
  • 2020-12-31 04:50

    If you don't want to use WMI, I can suggest systeminfo.exe. But, there may be a better way to do that.

    (systeminfo | Select-String 'Total Physical Memory:').ToString().Split(':')[1].Trim()
    
    0 讨论(0)
  • 2020-12-31 04:55

    Below gives the total physical memory.

    gwmi Win32_OperatingSystem | Measure-Object -Property TotalVisibleMemorySize -Sum | % {[Math]::Round($_.sum/1024/1024)}
    
    0 讨论(0)
提交回复
热议问题