title: Retrieving Windows Defender Status remotely
body: <p>I am using the following script to retrieve Windows Defender status remotely.</p>
  <pre><code>$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
  </code></pre>
  <p>However, I am quite new to PowerShell scripting and related protocols. Is this the best way of retrieving this information when I may have to run it over hundreds of computers?</p>