Connecting to a Windows Instance

This guide shows you how to connect to Windows instances through Remote Desktop Protocol (RDP) to the Windows desktop or through a remote PowerShell session in the terminal.

Before you begin

Connecting to a Windows instance using RDP

You can use RDP to connect to a Windows instance and start a remote desktop session. This process allows you to interact with the Windows desktop remotely. Alternatively, you can connect to Windows instances using the PowerShell terminal.

Connect to the remote desktop on Windows instances using one of the following methods:

  • If you use the Chrome browser, you can connect through the Chrome RDP for Google Compute Engine Icon for RDP extension extension from Fusion Labs. This extension allows you to connect through the Cloud Platform Console.
  • Download the RDP file and manually connect through the Windows Remote Desktop Connection client or a third-party client.

Console

  1. Go to the VM instances page in the in the Cloud Platform Console.

    Go to the VM instances page

  2. Click the RDP button next to the instance that you want to connect to. A new browser window opens with the Chrome RDP for Google Compute Engine Icon for RDP extension extension.
  3. Enter your username and password. If this is your first time connecting to this instance, or if you have forgotten your password, read the documentation for Creating passwords for Windows instances.
  4. Click OK to connect.

Connect through an RDP client

  1. Install an RDP client. If you don't have a preference, install the Chrome RDP for Google Compute Engine Icon for RDP extension extension.
  2. Get your Windows instance's external IP. Go to the VM instances page in the Cloud Platform Console or run gcloud compute instances list to see a list of your instances with their External IP values.
  3. In your RDP client, provide your instance's external IP address as the IP address to connect to. For example, in the Chrome RDP extension, you would enter the IP address in the following format: Screenshot of the instance creation window with the required options set
  4. Enter your log-in information and leave the Domain field blank. If this is your first time connecting to this instance, or if you have forgotten your password, read the documentation for Creating passwords for Windows instances.

    Screenshot of the instance creation window with the required options set

If you run into issues logging in to your instance using RDP, you might not have a firewall rule that allows RDP traffic on port 3389 (tcp:3389). For instructions on how to add a firewall rule, see Adding a firewall.

On Linux workstations, use freerdp or Remmina to connect. The rdesktop client does not support NLA and does not work with the default Compute Engine settings.

Connecting to a Windows instance using the PowerShell terminal

If you have a Windows workstation with PowerShell, you can connect to your Windows Server instances through a remote PowerShell session. This process is similar to connecting to a Linux instance over SSH.

  1. If you have not created a username and password on the remote Windows instance yet, create or reset your Windows password.

  2. Add a firewall rule that opens port 5986 on the Cloud Platform network where your Windows Server instance is located.

  3. On your local workstation, open the PowerShell terminal.

  4. Optionally, you can initialize a variable to hold your user credentials so you do not need to enter them each time you connect to the instance. If you skip this step, you receive a prompt for your username and password later.

    PS C:> $credentials = Get-Credential
    

    Where:

    • [USERNAME] is your username on the remote Windows instance.
    • [PASSWORD] is your password on the remote Windows instance.
  5. Use the Enter-PSSession command to start a remote PowerShell session and include the flags to use SSL and skip credentials checks.

    PS C:> Enter-PSSession -ComputerName [IP_ADDRESS] -UseSSL -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck) -Credential $credentials
    

    Where [IP_ADDRESS] is the IP address, DNS name, or Windows computer name for the instance to which you want to connect.

If the connection is successful, the command prompt changes to include the IP address of the remote Windows instance. You can now use the terminal to run PowerShell commands on the remote Windows Server instance.

As an alternative to the Enter-PSSession command, you can run Invoke-Command with the -ScriptBlock flag to execute PowerShell commands on the remote instance without establishing an interactive session.

PS C:\> Invoke-Command -ComputerName [IP_ADDRESS] -ScriptBlock { [SCRIPT] } -UseSSL -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck) -Credential $credentials

Where:

  • [IP_ADDRESS] is the IP address, DNS name, or Windows computer name for the instance to which you want to connect.
  • [SCRIPT] is one or more commands to run on the remote instance. For example, specify Get-EventLog -log "Windows PowerShell" to get a list of log events.

What's next

Send feedback about...

Compute Engine Documentation