[英]How can i filter out information in powershell?
How can I filter out information in powershell?如何过滤掉 powershell 中的信息?
For instance, i run system info on a remote machine, I would write:例如,我在远程机器上运行系统信息,我会写:
systeminfo -s <computerName>
However how can i do this for many machines and also how can I filter out the information?但是,我如何为许多机器执行此操作,以及如何过滤掉信息?
I want to search many machines for just "Total Physical Memory"我想在很多机器上搜索“总物理内存”
Windows 10 64-bit. Windows 10 64 位。 PowerShell 5.
PowerShell 5.
How to find "Total Physical Memory" using PowerShell for one computer.如何在一台计算机上使用 PowerShell 查找“总物理内存”。 Replace
computername
.替换
computername
名。
systeminfo -s computername | Select-String 'Total Physical Memory:').ToString().Split(':')[1].Trim()
I can't test this:我无法对此进行测试:
How to find "Total Physical Memory" using a PowerShell function for many computers.对于许多计算机,如何使用 PowerShell function 查找“总物理内存”。
Get-SystemInfo -ComputerName server01,server02
You can get get-systeminfo
at gallery.technet.microsoft.com .您可以在gallery.technet.microsoft.com获取
get-systeminfo
。
As suggested by @Lee_Daily, it would be easier and more direct to use Powershell.正如@Lee_Daily 所建议的,使用 Powershell 会更容易、更直接。
This will produce the amount of physical memory in GiB.这将产生以 GiB 为单位的物理 memory 数量。
(Get-CimInstance -ClassName CIM_PhysicalMemory | Measure-Object -Sum Capacity).Sum / 1GB
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.