[英]Powershell output for Microsoft Defender status
I'm very new to PowerShell and I have question in regards to Microsoft Intune and PowerShell.我对 PowerShell 非常陌生,我对 Microsoft Intune 和 PowerShell 有疑问。
I have this GetMPComputerStatus|select AMRunning
to check if Defender is "Normal" or "Passive", that's the only two outcomes.我有这个GetMPComputerStatus|select AMRunning
来检查 Defender 是“正常”还是“被动”,这是仅有的两个结果。
How do I make an if statement so I can get all the devices which returns "Passive"如何进行 if 语句,以便获取所有返回“Passive”的设备
Hope i'm asking the right question and I provided enough information to my problem希望我问的是正确的问题,并且我为我的问题提供了足够的信息
Best regards此致
When you say "get all the devices which returns "Passive"" , I assume you need to check different computers and filter out all that have their antimalware software not in "Normal" mode.当您说“获取所有返回“被动”的设备时,我假设您需要检查不同的计算机并过滤掉所有不处于“正常”模式的反恶意软件。
For that you can use the -CimSession
parameter that allows you to enter (an array) of computernames to test.为此,您可以使用-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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.