Unable to connect to GCP windows VM using gcloud compute SSH

Dear Community,

I want to use the same gcloud compute SSH command to connect to the windows VMs so that I can use the same connection mechanism for the SSH from AWX. I am following the doc https://cloud.google.com/compute/docs/connect/windows-ssh#running_vm . To achieve that I added the following metadata key (at instance level): for my windows server 2016 server by which I am trying to install openssh and sshd.

Key: windows-startup-script-ps1

Value:

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' `
  -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
Set-NetFirewallRule -Name sshd -Profile 

Even after adding this, I get below error while connecting through gcloud compute SSH.

Make sure this host can be reached over ssh: OS Login is not available on Windows VMs

I know OSLogin is only for linux machines. So how can I achieve SSH to the windows machines ?

@kurokobo , @wayt , @bcoca please help

I have not used windows in 23 years … not sure I’m the right person to help

2 Likes

IAP tunneling can get you access to WinRM which especially for Windows 2016 will be better supported than SSH. The truck will be finding away to get the tunnel built similar to how we do for SSH via ProxyCommand.

1 Like

Before asking questions, please make sure to do plenty of your own research and try things out yourself.

It’s helpful if you organize what you’ve considered, what you’ve looked up, what you’ve tried, and what results you got.
Also, please provide enough background information about the issue, as well as any relevant sample config files or playbooks.

If you ask lots of questions without sharing these details—as if you’re just using us instead of Google or ChatGPT—it’s not really a great approach, in my opinion.
At the very least, I’m not your dedicated consultant.

1 Like

Apologies @kurokobo , I can understand. Since I tried already couple of ways to connect the machine using gcloud compute ssh ( not working ) and not able to post everything I tried yesterday since the post will look long. From next time will try to put all my tries here so that responders will have better idea. As always Thanks lot for your response.