简体   繁体   English

如何过滤掉 powershell 中的信息?

[英]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.

相关问题 如何将多个字符串转换为 Powershell 中的 IP 地址,以便过滤掉 IPv6 - How would I convert multiple strings to an IP address in Powershell so I can filter out IPv6 如何在不调用Powershell的情况下获取完整的操作系统信息? - How can I get full OS information without calling powershell? 如何获取cmd过滤掉所有不必要的内容? - How can I get cmd to filter out all the unnecessary stuff? 如何从IMMDevice获取信息? - How do I get information out of IMMDevice? Dashing在启动时失败,我怎样才能找到更多信息? - Dashing fails silent on start up, how can I find out more information? 如何根据对MessageBox的响应阻止用户注销或使用Powershell锁定工作站? - How can I stop a user from logging out or locking a workstation using Powershell based on the response to a MessageBox? 如何从 Powershell 脚本中的 Get-ADUser 过滤器获取结果,以便验证该用户是否存在? - How can I get results from Get-ADUser Filter in my Powershell script so I can validate if that user exists or not correctly? 如何过滤 powershell 标准输出 - How filter powershell stdout 如何使用用户列表编写带有 For 循环的 Powershell 脚本以打印出 Active Directory 信息 - How to write a Powershell Script with a For-loop using a List of Users to Print Out Active Directory Information 如何使用Powershell过滤包含的文件数量的目录 - How do I filter directories with powershell on the amount of files contained
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM