繁体   English   中英

如何过滤掉 powershell 中的信息?

[英]How can i filter out information in powershell?

如何过滤掉 powershell 中的信息?

例如,我在远程机器上运行系统信息,我会写:

systeminfo -s <computerName>

但是,我如何为许多机器执行此操作,以及如何过滤掉信息?

我想在很多机器上搜索“总物理内存”

系统信息截图

Windows 10 64 位。 PowerShell 5.

如何在一台计算机上使用 PowerShell 查找“总物理内存”。 替换computername名。

systeminfo -s computername | Select-String 'Total Physical Memory:').ToString().Split(':')[1].Trim()

我无法对此进行测试:

对于许多计算机,如何使用 PowerShell function 查找“总物理内存”。

Get-SystemInfo -ComputerName server01,server02 

您可以在gallery.technet.microsoft.com获取get-systeminfo

正如@Lee_Daily 所建议的,使用 Powershell 会更容易、更直接。

这将产生以 GiB 为单位的物理 memory 数量。

(Get-CimInstance -ClassName CIM_PhysicalMemory | Measure-Object -Sum Capacity).Sum / 1GB

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM