diff --git a/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 b/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 index 51b16f210..d37ff5561 100644 --- a/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 +++ b/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 @@ -604,7 +604,7 @@ Describe "-ReportSummary switch" { } It "prints the correct report summary using the -NoReportSummary switch" { - $result = & $pwshExe -Command "Import-Module '$pssaPath'; Invoke-ScriptAnalyzer -ScriptDefinition gci -ReportSummary" + $result = & $pwshExe -NoProfile -Command "Import-Module '$pssaPath'; Invoke-ScriptAnalyzer -ScriptDefinition gci -ReportSummary" "$result" | Should -BeLike $reportSummaryFor1Warning } diff --git a/build.psm1 b/build.psm1 index 6e3ad2edf..3dc9c0ec0 100644 --- a/build.psm1 +++ b/build.psm1 @@ -351,7 +351,7 @@ function Test-ScriptAnalyzer } else { $powershell = (Get-Process -id $PID).MainModule.FileName - & ${powershell} -Command $scriptBlock + & ${powershell} -NoProfile -Command $scriptBlock } } finally {