1

I was able to connect to a Linux server from my Windows 10 PC using VSCode's Remote-SSH extension without any issues before. However, I am now facing a strange problem where I get an error message that says:

Could not establish connection to "MyServerName": Got bad result from install script

I have tried reinstalling VSCode and also tried to delete the file C:\Users\<your_user_name>\.ssh\known_host, but none of them worked for me.

Furthermore, I noticed that I cannot open cmd.exe normally on my Windows PC. Whenever I try to open it, it just pops up and then closes immediately, while PowerShell works fine.

I suspect that this might be the cause of my issue. If I can solve the issue with cmd.exe crashing, then the Remote-SSH issue might also be resolved.

After noticing the issue with cmd.exe crashing, I discovered that both "Windows Terminal" and "wt.exe" were missing. Despite attempting to reinstall Windows Terminal from the Microsoft Store, I am still unable to open cmd.exe as I could before.

reference solved reinstall terminal's method:

Could someone please help me with this issue? I have been stuck on this for a long time.

wen
  • 825
  • 1
  • 8
  • 12

1 Answers1

1

I finally solved the issue by both the answer of @ZhangGe6 from this post!! and Could not establish connection to "hostname". I would provide a clear and complete process explanation in the hopes that it may help anyone else who is facing the same problem as me.

In short, the issue was indeed caused by cmd.exe crashing. Therefore, we need to resolve this problem. You can follow the bullet list steps to solve it. If you don't know how to do it, I will explain it in more detail below the bullet list.

Solution:

  • Change the registry values Autorun in HKEY_CURRENT_USER\Software\Microsoft\Command Processor from if exists to a blank (as this link suggests). Detail step as following:
1. To open Run command window, you can either:
(1-1) Use the shortcut keys: 'Windows + R', or 
(1-2) Right Click "Start", and click "Run" to open. 

2. Registry Values Located in Registry Editor, to open it:
Type 'regedit' in the Run command window, and then press Enter.'

3. Now you can change the registry values "Autorun" in "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" from "if exists" to a blank.

After doing that, my cmd.exe works fine! However, the usual problem faced by VSCode Remote-SSH "Could not establish connection to hostname" appear again.

  • You can simplify the solution by deleting the fingerprint saved within the known_hosts file. In Windows, this is placed at C:\Users\<your_user_name>\.ssh\known_host reference post.

Finally, Remote SSH works again.

wen
  • 825
  • 1
  • 8
  • 12