Hello,
I am trying to get a scheduled task together to check antivirus on servers by using get-mpcomputerstatus.
The script i currently works for 2016 and 2019, but not for 2012. 2012 uses get-mprotcomputerstatus, but only if i enable the module using:
Import-Module “$env:ProgramFiles\Microsoft Security Client\MpProvider”
I have almost 600 2012 servers, so trying to enable this module on all of them with a script.
I’ve tried;
$Session = Start-PSSession -ComputerName server1
Invoke-Command -Session $Session -ScriptBlock { Import-Module “$env:ProgramFiles\Microsoft Security Client\MpProvider” }
Import-PSSession $Session
Invoke-Command -computername "server1" -ScriptBlock Import-Module “$env:ProgramFiles\Microsoft Security Client\MpProvider” -Credential $cred
So far, neither of these work. The script runs without error, but spot checking on some servers by running get-command -module mpprovider, nothing is there still.
Any help would be appreciated.