PowerShell tool fails with exit code 1 on Windows when pwsh installed via winget
Resolved 💬 3 comments Opened May 3, 2026 by cveld Closed May 20, 2026
Description
The PowerShell tool (pwsh) fails with Exit code 1 on Windows, even when PowerShell 7 is correctly installed via winget. The Bash tool calling pwsh -Command "..." works fine, so the issue is specific to how Claude Code's PowerShell tool invokes pwsh.
Steps to reproduce
- Install PowerShell 7 via winget:
winget install Microsoft.PowerShell - Open Claude Code on Windows
- Ask Claude to run any PowerShell command using the PowerShell tool
Expected behavior
PowerShell tool executes the command and returns output.
Actual behavior
Exit code 1
No output, no error message.
Environment
- OS: Windows 11 Enterprise 10.0.26100
- PowerShell version: 7.6.1.0 (installed via
winget install Microsoft.PowerShell) - Claude Code version 2.1.126
- pwsh location:
C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\pwsh.exe - Bash tool calling
pwsh -Command "Write-Output test"works correctly
Workaround
Using the Bash tool with pwsh -Command "..." works as a workaround.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗