我對 PowerShell 非常陌生,我對 Microsoft Intune 和 PowerShell 有疑問。
我有這個GetMPComputerStatus|select AMRunning來檢查后衛是“正常”還是“被動”,這是唯一的兩個結果。
如何進行 if 陳述句,以便獲取所有回傳“Passive”的設備
希望我問的是正確的問題,并且我為我的問題提供了足夠的資訊
此致
uj5u.com熱心網友回復:
當您說“獲取所有回傳“被動”的設備時,我假設您需要檢查不同的計算機并過濾掉所有不處于“正常”模式的反惡意軟體。
為此,您可以使用-CimSession允許您輸入(一個陣列)計算機名進行測驗的引數。
$computers = 'PC01', 'PC02', 'PC03' # the computers you need to check
Get-MpComputerStatus -CimSession $computers |
Where-Object {$_.AMRunningMode -eq 'Passive' } | # or use Where-Object {$_.AMRunningMode -ne 'Normal' }
Select-Object PsComputerName, AMRunningMode
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/327026.html
上一篇:位置引數有問題
