2016-09-24 11:52:52 +00:00
|
|
|
# Description:
|
|
|
|
# This script disables Windows Defender.
|
|
|
|
|
|
|
|
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\force-mkdir.psm1
|
|
|
|
|
|
|
|
$tasks = @(
|
|
|
|
"\Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance"
|
|
|
|
"\Microsoft\Windows\Windows Defender\Windows Defender Cleanup"
|
|
|
|
"\Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan"
|
|
|
|
"\Microsoft\Windows\Windows Defender\Windows Defender Verification"
|
|
|
|
)
|
|
|
|
|
|
|
|
foreach ($task in $tasks) {
|
|
|
|
$parts = $task.split('\')
|
|
|
|
$name = $parts[-1]
|
|
|
|
$path = $parts[0..($parts.length-2)] -join '\'
|
|
|
|
|
|
|
|
echo "Trying to disable scheduled task $name"
|
|
|
|
Disable-ScheduledTask -TaskName "$name" -TaskPath "$path"
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "Disabling Windows Defender via Group Policies"
|
|
|
|
force-mkdir "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows Defender"
|
|
|
|
sp "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows Defender" "DisableAntiSpyware" 1
|
|
|
|
sp "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows Defender" "DisableRoutinelyTakingAction" 1
|
|
|
|
force-mkdir "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows Defender\Real-Time Protection"
|
|
|
|
sp "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows Defender\Real-Time Protection" "DisableRealtimeMonitoring" 1
|
|
|
|
|
|
|
|
echo "Removing Windows Defender context menu item"
|
|
|
|
si "HKLM:\SOFTWARE\Classes\CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32" ""
|