Skip to content

Commit

Permalink
Update logic of checking real time protection status (ticket Windows …
Browse files Browse the repository at this point in the history
…Defender is disabled, other tool is used - although it is marked as "green" #225)
  • Loading branch information
Steffen Winternheimer committed Jan 30, 2023
1 parent 30407fe commit 74df577
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12652,14 +12652,10 @@ $hyperVStatus = CheckHyperVStatus
Task = "(L1) Ensure 'Turn off real-time protection' is set to 'Disabled'"
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" `
-Name "DisableRealtimeMonitoring" `
| Select-Object -ExpandProperty "DisableRealtimeMonitoring"

if ($regValue -ne 0) {
$status = Get-MpComputerStatus
if ($status.RealTimeProtectionEnabled -ne $true) {
return @{
Message = "Registry value is '$regValue'. Expected: 0"
Message = "Real-time protection is not activated."
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12557,14 +12557,10 @@ $hyperVStatus = CheckHyperVStatus
Task = "(L1) Ensure 'Turn off real-time protection' is set to 'Disabled'"
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" `
-Name "DisableRealtimeMonitoring" `
| Select-Object -ExpandProperty "DisableRealtimeMonitoring"

if ($regValue -ne 0) {
$status = Get-MpComputerStatus
if ($status.RealTimeProtectionEnabled -ne $true) {
return @{
Message = "Registry value is '$regValue'. Expected: 0"
Message = "Real-time protection is not activated."
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9465,14 +9465,10 @@ $hyperVStatus = CheckHyperVStatus
Task = "(L1) Ensure 'Turn off real-time protection' is set to 'Disabled'"
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" `
-Name "DisableRealtimeMonitoring" `
| Select-Object -ExpandProperty "DisableRealtimeMonitoring"

if ($regValue -ne 0) {
$status = Get-MpComputerStatus
if ($status.RealTimeProtectionEnabled -ne $true) {
return @{
Message = "Registry value is '$regValue'. Expected: 0"
Message = "Real-time protection is not activated."
Status = "False"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9447,14 +9447,10 @@ $hyperVStatus = CheckHyperVStatus
Task = "(L1) Ensure 'Turn off real-time protection' is set to 'Disabled'"
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" `
-Name "DisableRealtimeMonitoring" `
| Select-Object -ExpandProperty "DisableRealtimeMonitoring"

if ($regValue -ne 0) {
$status = Get-MpComputerStatus
if ($status.RealTimeProtectionEnabled -ne $true) {
return @{
Message = "Registry value is '$regValue'. Expected: 0"
Message = "Real-time protection is not activated."
Status = "False"
}
}
Expand Down
12 changes: 4 additions & 8 deletions ATAPAuditor/AuditGroups/RSSeverityTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -545,15 +545,11 @@ $hyperVStatus = CheckHyperVStatus
Task = "(L1) Ensure 'Turn off real-time protection' is set to 'Disabled'"
Test = {
try {
$regValue = Get-ItemProperty -ErrorAction Stop `
-Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" `
-Name "DisableRealtimeMonitoring" `
| Select-Object -ExpandProperty "DisableRealtimeMonitoring"

if ($regValue -eq 1) {
$status = Get-MpComputerStatus
if ($status.RealTimeProtectionEnabled -ne $true) {
return @{
Message = "Registry value is '$regValue'. Expected: 0"
Status = "False"
Message = "Real-time protection is not activated."
Status = "False"
}
}
}
Expand Down

0 comments on commit 74df577

Please sign in to comment.