Originally created by: kumaakh
On Windows members where OpenSSH is configured to use cmd.exe as the default shell, every execute_command call fails before the actual command runs:
Exit code: 1
[stderr]
'Set-Location' is not recognized as an internal or external command,
operable program or batch file.
The fleet agent changes to the work directory using Set-Location (a PowerShell cmdlet). When OpenSSH launches cmd.exe instead of PowerShell, the command fails immediately.
Windows OpenSSH allows configuring the default shell via the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH
DefaultShell = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
(or C:\Program Files\PowerShell\7\pwsh.exe for PowerShell 7+)
If this key is absent, OpenSSH falls back to cmd.exe.
Update the fleet Windows member setup/onboarding instructions to include this step:
Set PowerShell as the OpenSSH default shell (run as Administrator on the Windows member):
```powershell
PowerShell 5 (built-in)
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
OR PowerShell 7+ (if installed)
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\PowerShell\7\pwsh.exe" -PropertyType String -Force
```Restart the OpenSSH service after the change:
powershell Restart-Service sshd
Originally posted by: kumaakh
Fixed.
docs/learnings.mddocuments the DefaultShell registry key, the PowerShell switch command, sshd restart, and the adminauthorized_keysquirk — covering all Windows OpenSSH gotchas for fleet members.Ticket changed by: kumaakh