From 05c460a0b65d60f1c51bdb3447b5a934ac338919 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Wed, 3 Nov 2021 16:14:29 +0300 Subject: [PATCH] Set Microsoft Defender Antivirus to passive mode (#4415) --- images/win/scripts/Installers/Configure-Antivirus.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/images/win/scripts/Installers/Configure-Antivirus.ps1 b/images/win/scripts/Installers/Configure-Antivirus.ps1 index 9a87ca52..7cbf43b3 100644 --- a/images/win/scripts/Installers/Configure-Antivirus.ps1 +++ b/images/win/scripts/Installers/Configure-Antivirus.ps1 @@ -2,4 +2,12 @@ Write-Host "Set antivirus parameters" Set-MpPreference -ScanAvgCPULoadFactor 5 -ExclusionPath "D:\", "C:\" Write-Host "Disable Antivirus" -Set-MpPreference -DisableRealtimeMonitoring $true \ No newline at end of file +Set-MpPreference -DisableRealtimeMonitoring $true + +# https://github.com/actions/virtual-environments/issues/4277 +# https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/microsoft-defender-antivirus-compatibility?view=o365-worldwide +$atpRegPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Advanced Threat Protection' +if (Test-Path $atpRegPath) { + Write-Host "Set Microsoft Defender Antivirus to passive mode" + Set-ItemProperty -Path $atpRegPath -Name 'ForceDefenderPassiveMode' -Value '1' -Type 'DWORD' +}