Skip to content

Instantly share code, notes, and snippets.

@nanoDBA
Created November 20, 2021 11:05
Show Gist options
  • Select an option

  • Save nanoDBA/2bf8e484efad70fed139c0f0d3fa9a34 to your computer and use it in GitHub Desktop.

Select an option

Save nanoDBA/2bf8e484efad70fed139c0f0d3fa9a34 to your computer and use it in GitHub Desktop.
Disable and Uninstall Windows Defender - Requires Reboot
if (! ( (Get-WindowsFeature -Name Windows-Defender-Features).Installed)) {
Write-Output "Windows Defender is not installed" | Out-String | Write-Host -ForegroundColor Yellow
}
if ( (Get-WindowsFeature -Name Windows-Defender-Features).Installed) {
#Disable Windows Defender http://www.thomasmaurer.ch/2016/07/how-to-disable-and-configure-windows-defender-on-windows-server-2016-using-powershell/
Set-MpPreference -DisableRealtimeMonitoring $true
# uninstall Windows Defender https://technet.microsoft.com/en-us/windows-server-docs/security/windows-defender/windows-defender-overview-windows-server
Get-WindowsFeature -Name Windows-Defender-Features
Uninstall-WindowsFeature -Name Windows-Defender-Features -Confirm:$false
Get-WindowsFeature -Name Windows-Defender-Features
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment