How can I filter out information in 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. PowerShell 5.
How to find "Total Physical Memory" using PowerShell for one computer. Replace 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.
Get-SystemInfo -ComputerName server01,server02
You can get get-systeminfo
at gallery.technet.microsoft.com .
As suggested by @Lee_Daily, it would be easier and more direct to use Powershell.
This will produce the amount of physical memory in GiB.
(Get-CimInstance -ClassName CIM_PhysicalMemory | Measure-Object -Sum Capacity).Sum / 1GB
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.