2021-01-10 17:33:48 +00:00
|
|
|
# This will check for Malware, Antispyware, that Windows Defender is Healthy, last scan etc within the last 24 hours
|
|
|
|
|
|
|
|
$ErrorActionPreference= 'silentlycontinue'
|
|
|
|
$TimeSpan = (Get-Date) - (New-TimeSpan -Day 1)
|
|
|
|
|
|
|
|
if (Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Windows Defender/Operational';ID='1116','1118','1015','1006','5010','5012','5001','1123';StartTime=$TimeSpan})
|
|
|
|
|
|
|
|
{
|
2021-01-10 17:51:06 +00:00
|
|
|
Write-Output "Virus Found or Issue with Defender"
|
2021-01-10 17:33:48 +00:00
|
|
|
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Windows Defender/Operational';ID='1116','1118','1015','1006','5010','5012','5001','1123';StartTime=$TimeSpan}
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
2021-01-10 17:51:06 +00:00
|
|
|
Write-Output "No Virus Found, Defender is Healthy"
|
2021-01-10 17:33:48 +00:00
|
|
|
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Windows Defender/Operational';ID='1150','1001';StartTime=$TimeSpan}
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Exit $LASTEXITCODE
|