簡體   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