【问题标题】:Retrieving Windows Defender Status remotely远程检索 Windows Defender 状态
【发布时间】:2021-01-08 23:18:24
【问题描述】:

我正在使用以下脚本远程检索 Windows Defender 状态。

$password = ConvertTo-SecureString “myPassword” -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential (“myUserNamer”, $password)
$sessionOption = New-CimSessionOption -Protocol WsMan
$session = New-CIMSession -ComputerName myMachineName -Credential $credentials -SessionOption
Get-MpPreference -CimSession $session

但是,我对 PowerShell 脚本和相关协议还很陌生。当我可能需要在数百台计算机上运行这些信息时,这是检索此信息的最佳方式吗?

【问题讨论】:

    标签: windows powershell powershell-remoting windows-defender


    【解决方案1】:

    是否需要用于所有机器或选定的机器?

    例如: 你可以在你需要的机器上运行一个远程会话,然后运行命令。

    Enter-PSSession [VMname]
    Get-MpComputerStatus
    

    将 [VMname] 替换为您要查找的 VM/计算机的名称。

    Enter-PSSession Computer-01
    Get-MpComputerStatus
    

    如果这就是你要找的。​​p>

    【讨论】:

    • 我需要在多台机器上运行它,但如果可能的话,我想并行和异步运行它。您能否详细说明您建议的方法与我使用的方法相比有何优势?
    猜你喜欢
    • 1970-01-01
    • 2010-09-12
    • 2020-05-07
    • 1970-01-01
    • 2016-10-23
    • 2014-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多