如何使用PowerShell获取远程计算机的免费物理内存

cul*_*ter 6 windows powershell memory-management powershell-remoting

我有这个:

(Get-WMIObject Win32_logicaldisk -computername computer).TotalPhysicalMemory
Run Code Online (Sandbox Code Playgroud)

获取远程计算机上安装的物理内存的大小.如何获得该计算机的免费内存?

我试过了

(Get-WMIObject Win32_logicaldisk -computername computer).FreePhysicalMemory
Run Code Online (Sandbox Code Playgroud)

和其他一些变种,但没有效果.是否有一些可能的"过滤器"列表?

lat*_*kin 11

每当您想要查看对象的所有属性时,请将其传递给Format-List *.

Get-WmiObject Win32_LogicalDisk | format-list *
Get-WmiObject Win32_OperatingSystem | fl *
Run Code Online (Sandbox Code Playgroud)

或者,如果您正在寻找特定的属性,则可以使用通配符搜索

Get-WmiObject Win32_OperatingSystem | fl *free*
Run Code Online (Sandbox Code Playgroud)

正如阿奎那所说,你想要的是Win32_OperatingSystem阶级FreePhysicalMemory财产. Win32_LogicalDisk跟踪硬盘,而不是RAM.


Sha*_*evy 8

您还可以尝试Get-Countercmdlet:

(Get-Counter -Counter "\Memory\Available MBytes" -ComputerName computer).CounterSamples[0].CookedValue
Run Code Online (Sandbox Code Playgroud)


aqu*_*nas 4

你想要的Win32_OperatingSystem不是Win32_logicaldisk我相信的。