Elevate to TrustedInstaller to disable Defender on Windows 10

This commit is contained in:
gregclermont
2021-05-01 23:51:53 +02:00
parent 8d95760f48
commit 2c22724101
2 changed files with 40 additions and 1 deletions

View File

@@ -13,7 +13,12 @@ If ($hostname -eq "win10") {
# Adding Defender exclusions just in case
Set-MpPreference -ExclusionPath "C:\Tools"
Add-MpPreference -ExclusionPath "C:\Users\vagrant\AppData\Local\Temp"
Set-MpPreference -DisableRealtimeMonitoring $true
. c:\vagrant\scripts\Invoke-CommandAs.ps1
Invoke-CommandAs 'NT SERVICE\TrustedInstaller' {
Set-Service WinDefend -StartupType Disabled
Stop-Service WinDefend
}
}
# Windows Defender should be disabled by the GPO or uninstalled already, but we'll keep this just in case