Skip to content

Instantly share code, notes, and snippets.

@byinarie
Last active September 18, 2023 22:23
Show Gist options
  • Save byinarie/8ac87d955a9d179b30f0c1b3d522bdc8 to your computer and use it in GitHub Desktop.
Save byinarie/8ac87d955a9d179b30f0c1b3d522bdc8 to your computer and use it in GitHub Desktop.
getdef.ps1
$REGISTRY_KEYS = @(
'SOFTWARE\Policies\Microsoft\Windows Defender',
'SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection',
'SOFTWARE\Policies\Microsoft\Windows Defender\Reporting',
'SOFTWARE\Policies\Microsoft\Windows Defender\SpyNet'
)
$VALUES = @(
'DisableAntiSpyware',
'DisableAntiVirus',
'DisableIntrusionPreventionSystem',
'DisableBehaviorMonitoring',
'DisableIOAVProtection',
'DisableRealtimeMonitoring',
'DisableOnAccessProtection',
'DisableScanOnRealtimeEnable',
'DisableEnhancedNotifications',
'DisableBlockAtFirstSeen'
)
foreach ($key in $REGISTRY_KEYS) {
Write-Host "Registry Key: $key"
foreach ($valueName in $VALUES) {
try {
$value = Get-ItemProperty -Path "HKLM:\$key" -Name $valueName -ErrorAction Stop
Write-Host "$valueName = $($value.$valueName)"
} catch {
Write-Host "Error retrieving $valueName from $key: $_"
}
}
Write-Host ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment