sync: auto-sync from DESKTOP-0O8A1RL at 2026-05-15 15:23:02
Author: Mike Swanson Machine: DESKTOP-0O8A1RL Timestamp: 2026-05-15 15:23:02
This commit is contained in:
24
session-logs/disable_defender.ps1
Normal file
24
session-logs/disable_defender.ps1
Normal file
@@ -0,0 +1,24 @@
|
||||
$regPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender"
|
||||
if (-not (Test-Path $regPath)) { New-Item -Path $regPath -Force | Out-Null }
|
||||
Set-ItemProperty -Path $regPath -Name "DisableAntiSpyware" -Value 1 -Type DWord
|
||||
Write-Host "Policy key set"
|
||||
|
||||
Set-MpPreference -DisableRealtimeMonitoring $true -ErrorAction SilentlyContinue
|
||||
Set-MpPreference -DisableBehaviorMonitoring $true -ErrorAction SilentlyContinue
|
||||
Set-MpPreference -DisableIOAVProtection $true -ErrorAction SilentlyContinue
|
||||
Set-MpPreference -DisableScriptScanning $true -ErrorAction SilentlyContinue
|
||||
Set-MpPreference -DisableArchiveScanning $true -ErrorAction SilentlyContinue
|
||||
Write-Host "MpPreference overrides applied"
|
||||
|
||||
try {
|
||||
Stop-Service -Name WinDefend -Force -ErrorAction Stop
|
||||
Set-Service -Name WinDefend -StartupType Disabled
|
||||
Write-Host "WinDefend: stopped and disabled"
|
||||
} catch {
|
||||
Write-Host "WinDefend stop: $_"
|
||||
}
|
||||
|
||||
$pref = Get-MpPreference
|
||||
Write-Host "RealtimeMonitoring disabled: $($pref.DisableRealtimeMonitoring)"
|
||||
$regVal = (Get-ItemProperty -Path $regPath -Name DisableAntiSpyware -ErrorAction SilentlyContinue).DisableAntiSpyware
|
||||
Write-Host "Policy DisableAntiSpyware: $regVal"
|
||||
Reference in New Issue
Block a user