From 54a84b8640641a21004d6696ebb706dfcc757df1 Mon Sep 17 00:00:00 2001 From: Ahmed Shawky Date: Thu, 25 Jun 2020 04:22:55 +0400 Subject: [PATCH] Make sure WinDefend service is not running when uninstalling Windows-Defender and Windows-Defender-Features features. --- Vagrant/scripts/install-redteam.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrant/scripts/install-redteam.ps1 b/Vagrant/scripts/install-redteam.ps1 index 0ad599c..ed3865d 100644 --- a/Vagrant/scripts/install-redteam.ps1 +++ b/Vagrant/scripts/install-redteam.ps1 @@ -12,7 +12,7 @@ If ($hostname -eq "win10") { } # Windows Defender should be disabled already by the GPO, sometimes it doesnt work -If ($hostname -ne "win10") { +If ($hostname -ne "win10" -And (Get-Service -Name WinDefend -ErrorAction SilentlyContinue).status -eq 'Running') { # Uninstalling Windows Defender (https://github.com/StefanScherer/packer-windows/issues/201) Uninstall-WindowsFeature Windows-Defender Uninstall-WindowsFeature Windows-Defender-Features