Menu

#145 Windows SSH members: document OpenSSH default shell configuration (PowerShell required)

closed
nobody
None
2026-04-20
2026-04-16
Anonymous
No

Originally created by: kumaakh

Problem

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.

Root cause

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.

Fix

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

Notes

  • The tunnel provider (e.g. OpenRPort, Tailscale, ngrok) has no role in shell selection — this is purely an OpenSSH configuration concern.
  • This only affects Windows members; Linux/macOS members use bash by default and are unaffected.

Related

Tickets: #146

Discussion

  • Anonymous

    Anonymous - 2026-04-20

    Originally posted by: kumaakh

    Fixed. docs/learnings.md documents the DefaultShell registry key, the PowerShell switch command, sshd restart, and the admin authorized_keys quirk — covering all Windows OpenSSH gotchas for fleet members.

     
  • Anonymous

    Anonymous - 2026-04-20

    Ticket changed by: kumaakh

    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB