Configure defender process exceptions when running tests (#13470)

* Configure defender process exceptions when running tests

* Use explicit %ls

* Save state

* Save state

* Add exceptions before the package is installed

* Remove extra call
This commit is contained in:
Blue 2025-09-10 19:36:25 -07:00 committed by GitHub
parent 25f7a7b38c
commit 2eac1dafec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 12 deletions

View File

@ -2071,16 +2071,6 @@ Return Value:
THROW_HR_MSG(E_FAIL, "Test setup returned non-zero exit code %lu", ExitCode);
}
if (!g_pipelineBuildId.empty())
{
LxsstuRunCommand(std::format(
L"Powershell -NoProfile -Command \"Add-MpPreference -ExclusionPath '{}'\"",
wsl::windows::common::wslutil::GetMsiPackagePath().value())
.data());
LxsstuRunCommand(std::format(L"Powershell -NoProfile -Command \"Add-MpPreference -ExclusionPath '.'\"").data());
}
return true;
}
@ -2128,7 +2118,7 @@ Return Value:
commandLine = std::format(L"Get-MpThreat > \"{}\\Get-MpThreat.txt\"", g_dumpFolder);
LxsstuLaunchPowershellAndCaptureOutput(commandLine.data());
commandLine = std::format(L"Get-MpPreference > \"{}\\Get-MpPreference\"", g_dumpFolder);
commandLine = std::format(L"Get-MpPreference > \"{}\\Get-MpPreference.txt\"", g_dumpFolder);
LxsstuLaunchPowershellAndCaptureOutput(commandLine.data());
}

View File

@ -4,4 +4,8 @@ rem Required to make cloudtest use our version of taef
setx /M CloudTestWorkerCustomTaefExe "%1\taef\te.exe"
mkdir %2\WexLogFileOutput
mklink /D %1\WexLogFileOutput %2\WexLogFileOutput
mklink /D %1\WexLogFileOutput %2\WexLogFileOutput
rem These need to run before the package is installed
powershell -NoProfile -Command "Add-MpPreference -ExclusionPath 'C:\Program Files\WSL'"
powershell -NoProfile -Command "Add-MpPreference -ExclusionProcess @('wsl.exe', 'wslg.exe', 'wslconfig.exe', 'wslrelay.exe', 'wslhost.exe', 'msrdc.exe', 'wslservice.exe', 'msal.wsl.proxy.exe', 'te.processhost.exe')"