From 3affcf960f83eda5cdb18a6d79f6d10156cdade7 Mon Sep 17 00:00:00 2001 From: Julio Menendez Gonzalez Date: Tue, 21 Apr 2026 10:20:08 -0600 Subject: [PATCH] fix: pass -NoProfile -NonInteractive when invoking pwsh in requirement checks PowerShellModulesRequirementCheck.ExecutePowerShellCommandAsync launched pwsh with only -Command. Users whose PowerShell profile writes to stdout (e.g. a PSReadLine install prompt or posh-git warnings) would see that text prepended to the command output, causing int.TryParse of "$PSVersionTable.PSVersion.Major" to fail and the check to report "PowerShell is not available on this system" even on systems with pwsh 7+ installed. The same path is used for module detection and auto-install, which would silently misbehave for the same reason. MicrosoftGraphTokenProvider.BuildPowerShellArguments already uses "-NoProfile -NonInteractive" for pwsh; aligning this invocation with that convention. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../RequirementChecks/PowerShellModulesRequirementCheck.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Agents.A365.DevTools.Cli/Services/Requirements/RequirementChecks/PowerShellModulesRequirementCheck.cs b/src/Microsoft.Agents.A365.DevTools.Cli/Services/Requirements/RequirementChecks/PowerShellModulesRequirementCheck.cs index 6d016f26..5cf9b9c6 100644 --- a/src/Microsoft.Agents.A365.DevTools.Cli/Services/Requirements/RequirementChecks/PowerShellModulesRequirementCheck.cs +++ b/src/Microsoft.Agents.A365.DevTools.Cli/Services/Requirements/RequirementChecks/PowerShellModulesRequirementCheck.cs @@ -277,7 +277,7 @@ private async Task InstallModuleAsync(string moduleName, ILogger logger, C var processStartInfo = new ProcessStartInfo { FileName = executable, - Arguments = $"-Command \"{wrappedCommand}\"", + Arguments = $"-NoProfile -NonInteractive -Command \"{wrappedCommand}\"", RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false,