-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Remote-SSH Bug]: Can not connect from macos to windows (powershell error) #10510
Comments
I then installed powershell 7 via the MSI (from here). I also kept It sounds you've observing the default installation of powershell not functioning as expected? I am not reproducing that. Do you have other ideas on how I could reproduce your environment? |
Yes, it is not working as expected! Here is a screenshot with powershell version and path:
Unfortunately not. My workaround is to have a link powershell.exe -> pwsh.exe and put this in the Path before powershell 5.1, then I can connect. I hope that this does not create problems with scripts from IT that eventually rely on powershell 5.1 behaviour. The problem is that with powershell 5.1 the new lines piped into it are not understood. |
It appears from the screenshot that we both have the same major version of Powershell, so it's not clear to me why we would need to change the command. Am I misunderstanding a difference here on why my default Powershell works but yours doesn't?
(Forgive my powershell naiveness) Doesn't the screenshot you share indicate you have Powershell 10 installed? Where are you getting 5.1 from? What happens if you try moving Also, have you determined from the log that only the first line of the piped script is being executed? Did you end up validating that outside of VS Code (I see from the original post that you confirmed swapping out to |
Ah, i'm now seeing the version 5 at the top of your image, apologies for missing it. From your local mac could you try running this multi-line SSH command, so I can compare it with how I see it behave on my machine. ssh -T -o ConnectTimeout=15 '10.252.59.58' powershell << 'EOSSH'
$uuid="test-script"
"${uuid}: running"
$PSVersion = $PSVersionTable.PSVersion
Write-Output "PowerShell Version: $($PSVersion.Major).$($PSVersion.Minor).$($PSVersion.Build)"
"${uuid}: done"
EOSSH |
I don't understand what is different now, but now it is working!
|
Excellent, is the VS Code connection working too now? |
Yes VSCode is also working. Thank you for your help! I don't understand what changed in my setup. I also tried a similar shell command before in the shell without success. The only thing, i remember that I changed, is to activate the debug log in openssh. I sometimes have problems when debugging a python script on the windows machine to connect the debugger. Not every randomly chosen port from the debugger seems to be available. I think this is something similar to this microsoft/WSL#5306 with reserved ports. But I don't know if the issues are connected. |
I appreciate you going through this troubleshooting with me. If you come across a reliable way to repro the previous behavior, please let me know |
Is there an existing issue for this bug?
Required Troubleshooting Steps
remote.SSH.useLocalServer
setting (more info here)Connect Locally
It connects successfully
->
If I try to connect to the windows host from macos the ssh connection is successfull, but only one line of the script is piped to the powershell session (powershell). I installed the new powershell 7.4 on the windows machine, when I replace 'powershell' with 'pwsh' in the generated ssh command form VsCode I can manually pipe and execute the script successfully. Is there any configuration switch to tell VsCode to use 'pwsh' instead of 'powershell' in the generated ssh command?
VsCode
Version: 1.95.2
Commit: e8653663e8840adaf45af01eab5c627a5af81807
Date: 2024-11-07T11:07:22.054Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Darwin arm64 23.6.0
Windows
Edition: Windows 10 Enterprise
Version: 22H2
Os build: 19045.5131
Windows Feature Experience Pack 1000.19060.1000.0
PS C:> get-host
Name : ConsoleHost
Version : 5.1.19041.5129
InstanceId : 2fd726eb-8ce9-44f5-9613-f5821bae4237
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : de-DE
CurrentUICulture : de-DE
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Expected Behavior
No response
Steps To Reproduce
No response
Remote-SSH Log
Remote-SSH Log
Anything else?
No response
The text was updated successfully, but these errors were encountered: