The term 'Get-MpComputerStatus' is not recognized as
Posted: Mon Jul 24, 2023 3:23 am
Hi
I want to know the status of my antivirus 'Defender' on my 2012 and 2016 servers. But the command doesn't seem to be recognized by Nagios.
I don't have this problem on the 2019 server, and the Defender status is 'OK.'
The status is 'critical' for the 2012 and 2016 servers with the following message:"
"Get-MpComputerStatus : The term 'Get-MpComputerStatus' is not recognized as
the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\\Program Files (x86)\\Nagios\\NCPA\\plugins\\check_defender.ps1:8 char:88
+ ... e Windefend).Status -eq "Running" -and $(Get-MpComputerStatus).RealTi ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MpComputerStatus:String) []
, CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
"Get-MpThreatDetection : The term 'Get-MpThreatDetection' is not recognized as
the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\\Program Files (x86)\\Nagios\\NCPA\\plugins\\check_defender.ps1:15 char:13
+ if ([bool] (Get-MpThreatDetection) -eq $True){
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MpThreatDetection:String) [
], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Get-MpComputerStatus : The term 'Get-MpComputerStatus' is not recognized as
the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\\Program Files (x86)\\Nagios\\NCPA\\plugins\\check_defender.ps1:19 char:13
+ if ([bool]((Get-MpComputerStatus).AntivirusSignatureLastUpdated -lt ( ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MpComputerStatus:String) []
, CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
CRITICAL - Microsoft Defender is not running or the real-time protection was disabled"
The PowerShell script is stored locally on the servers (2012, 2016, 2019), and Nagios fetches it.
When I run the script directly while connected to the servers (2012, 2016, 2019), it works.
However, the 'Get-MpComputerStatus' and 'Get-MpThreatDetection' commands don't seem to be understood by Nagios on the servers (2012, 2016)
Can you help me please ?
Thanks
I want to know the status of my antivirus 'Defender' on my 2012 and 2016 servers. But the command doesn't seem to be recognized by Nagios.
I don't have this problem on the 2019 server, and the Defender status is 'OK.'
The status is 'critical' for the 2012 and 2016 servers with the following message:"
"Get-MpComputerStatus : The term 'Get-MpComputerStatus' is not recognized as
the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\\Program Files (x86)\\Nagios\\NCPA\\plugins\\check_defender.ps1:8 char:88
+ ... e Windefend).Status -eq "Running" -and $(Get-MpComputerStatus).RealTi ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MpComputerStatus:String) []
, CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
"Get-MpThreatDetection : The term 'Get-MpThreatDetection' is not recognized as
the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\\Program Files (x86)\\Nagios\\NCPA\\plugins\\check_defender.ps1:15 char:13
+ if ([bool] (Get-MpThreatDetection) -eq $True){
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MpThreatDetection:String) [
], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Get-MpComputerStatus : The term 'Get-MpComputerStatus' is not recognized as
the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\\Program Files (x86)\\Nagios\\NCPA\\plugins\\check_defender.ps1:19 char:13
+ if ([bool]((Get-MpComputerStatus).AntivirusSignatureLastUpdated -lt ( ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MpComputerStatus:String) []
, CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
CRITICAL - Microsoft Defender is not running or the real-time protection was disabled"
The PowerShell script is stored locally on the servers (2012, 2016, 2019), and Nagios fetches it.
When I run the script directly while connected to the servers (2012, 2016, 2019), it works.
However, the 'Get-MpComputerStatus' and 'Get-MpThreatDetection' commands don't seem to be understood by Nagios on the servers (2012, 2016)
Can you help me please ?
Thanks