Write-Host "Set antivirus parameters" Set-MpPreference -ScanAvgCPULoadFactor 5 -ExclusionPath "D:\", "C:\" Write-Host "Disable Antivirus" 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' }