title: How do I use Get-MPComputerStatus from Remote PC?
body: <p>I am trying to get  Domain pc's Antimalware status remotely, using powershell script. The following code works as expected, except I do not know how to pass the -computername parameter to the Get-MpComputerStatus command. It will return the Malware status of the local pc, that is running the script, but not the AD pc's. The rest of the variables, such as Location, Device Name, Serial Number are returned correctly:</p>
  <pre><code>    import-module ActiveDirectory
  
  Get-ADComputer -filter &quot;name -like '*'&quot; |
  Select -expandproperty name |
  
      ForEach {
  
   
    
     $results =  % { Get-ADComputer -Identity $_ -Properties Description }
     
     $cs = gwmi win32_bios -ComputerName $_ -ErrorAction SilentlyContinue
  
     $os = Get-Wmiobject -class Win32_operatingsystem  -computername $_  -ErrorAction SilentlyContinue  
           
     $bios = Get-WmiObject Win32_ComputerSystem -ComputerName $_ -ErrorAction SilentlyContinue 
  
   
        
     $rs =  Get-MpComputerStatus 
  
   #$rs = Get-WmiObject Win32_ComputerSystem -ComputerName $_ -ErrorAction SilentlyContinue |  Get-MpComputerStatus 
  
     $Object = New-Object PSObject -Property @{
      
      
         &quot;Device Name&quot; = $results.name 
         &quot;Physical Location&quot; = $results.description
         &quot;Employee&quot; = $bios.UserName        
         &quot;Last Logon Date&quot; = $results.LastLogonDate
         &quot;Category&quot; = $bios.ChassisSKUNumber
         &quot;Vendor&quot; = $bios.Manufacturer
         &quot;Make/Model&quot; = $bios.Model
         &quot;Serial Number&quot; = $cs.SerialNumber        
         'OS' = $os.caption
         'Malware Updated' = $rs.AntivirusSignatureLastUpdated
         'AntiSpyware Status' = $rs.AntispywareEnabled
         'AntiMalware Version' = $rs.AMServiceVersion
       
          }
          
  
         $Object |
    Select-Object &quot;Physical Location&quot;, &quot;Employee&quot;, &quot;Device Name&quot;, &quot;Malware Updated&quot;,'AntiSpyware Status','AntiMalware Version', &quot;Serial Number&quot;, &quot;Vendor&quot;, &quot;Make/Model&quot;, &quot;OS&quot;|
    Export-Csv  -Append -Force  -NoTypeInformation &quot;$($env:USERPROFILE)\documents\WinDef.csv&quot;  #&quot;c:\data\asset_inventory2.csv
   }
   
  </code></pre>