windows 如何使用 PowerShell 获取远程计算机的可用物理内存
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12250783/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get free physical memory of remote computer using PowerShell
提问by culter
I have this:
我有这个:
(Get-WMIObject Win32_logicaldisk -computername computer).TotalPhysicalMemory
to get size of physical memory installed on remote computer. How do I get the FREE memory of that computer?
获取远程计算机上安装的物理内存大小。我如何获得那台计算机的免费内存?
I've tried
我试过了
(Get-WMIObject Win32_logicaldisk -computername computer).FreePhysicalMemory
and some other variants, but with no effect. Is there some list of possible "filters"?
和其他一些变体,但没有效果。是否有一些可能的“过滤器”列表?
回答by latkin
Whenever you want to see all of the properties of an object, pipe it to Format-List *
.
每当您想查看对象的所有属性时,将其通过管道传输到Format-List *
.
Get-WmiObject Win32_LogicalDisk | format-list *
Get-WmiObject Win32_OperatingSystem | fl *
Or if you are looking for a particular propery, you can use wildcard search
或者,如果您正在寻找特定的属性,您可以使用通配符搜索
Get-WmiObject Win32_OperatingSystem | fl *free*
As Aquinas says, you want the Win32_OperatingSystem
class, FreePhysicalMemory
property. Win32_LogicalDisk
tracks hard disks, not RAM.
正如阿奎那所说,你想要Win32_OperatingSystem
阶级,FreePhysicalMemory
财产。 Win32_LogicalDisk
跟踪硬盘,而不是 RAM。
回答by Shay Levy
You can also try the Get-Counter
cmdlet:
您还可以尝试使用Get-Counter
cmdlet:
(Get-Counter -Counter "\Memory\Available MBytes" -ComputerName computer).CounterSamples[0].CookedValue
回答by aquinas
You want Win32_OperatingSystem
not Win32_logicaldisk
I believe.
你要Win32_OperatingSystem
不要Win32_logicaldisk
我信。