Set up Chrome Remote Desktop for Windows on Compute Engine  |  Cloud Architecture Center  |  Google Cloud (2024)

Interactive installation using RDP

To install Chrome Remote Desktop interactively, you need to be able toconnect to the remote VM using an RDP client. In this tutorial, you create theVM in thedefault VPC with default firewall rules,which exposes the RDP port 3339 to the internet.

If this is not possible in your environment, use thenon-interactive methodthat's described later in this document.

Create a Compute Engine instance

For the purposes of this tutorial, the default machine type is used. If you areusing this for your own environment, you may want to adjust the machine type,name, region, boot disk size, or other settings.

Console

  1. In the Google Cloud console, go to the VM Instances page:

Go to VM Instances

  1. Click Create.

  2. Set the instance name to crdhost.

  3. Enable the Enable display device checkbox because Chrome RemoteDesktop requires a display device on Windows VMs.

  4. Under Boot disk, click Change to open the Bootdisk panel.

  5. From the Operating system list, select Windows Server.

  6. From the Version list, select Windows Server 2022 Datacenter.

  7. Click Select to close the panel.

  8. Click Create.

Cloud Shell

  1. Open Cloud Shell.

    Open Cloud Shell

  2. Set your preferred zone:

    ZONE=us-central1-bREGION=us-central1gcloud config set compute/zone "${ZONE}"
  3. Create a Compute Engine instance by using the app image forWindows Server 2022 Datacenter:

    gcloud compute instances create crdhost \ --machine-type=e2-medium \ --scopes=cloud-platform \ --enable-display-device \ --image-family=windows-2022 \ --image-project=windows-cloud \ --boot-disk-size=50GB \ --boot-disk-device-name=crdhost

    This command creates a Windows Server 2022 virtual machine that has anattached display device (required for Chrome Remote Desktop on WindowsVMs) a 50GB boot disk, and grants the instance full access toGoogle Cloud APIs.

    Ignore the disk performance warning because you don't need highperformance for this tutorial.

Connect to the VM instance by using RDP

  1. In the Google Cloud console, go to the VM instances page.

    Go to the VM instances page

  2. Make sure a green check mark checkis displayed next to the name of your crdhost instance,indicating that the instance is ready.

  3. Click the instance name crdhost to open the VM instancedetails page.

  4. Under Remote access, click Set Windows password, and then clickSet to create your account on the remote machine.

    This step generates a password for you. Make a note of the password or copyit to a secure temporary file.

  5. To connect to the remote instance, click the arrowarrow_drop_downnext to the RDP button, and then select Download the RDPfile. You can open the RDP file by using your preferred RDP client.

  6. When your RDP client prompts for a password, enter the passwordthat you generated earlier.

  7. When you're prompted whether you want your computer discoverable byother PCs and devices on the network, click No.

  8. Close the Server Manager Dashboard if it is open.

Install the Chrome Remote Desktop service

The next step is to install Google Chrome and the Chrome Remote Desktopservice on the VM instance.

  1. In your RDP session, click Start on the Windows taskbar,type PowerShell, and then select the Windows PowerShell app.

  2. At the PowerShell prompt, download and run the Chrome Remote Desktop Hostinstaller.

     $installer = "$env:TEMP\chromeremotedesktophost.msi" $uri = 'https://dl.google.com/edgedl/chrome-remote-desktop/chromeremotedesktophost.msi' (New-Object Net.WebClient).DownloadFile($uri,"$installer") && ` Start-Process $installer -Wait && ` Remove-Item $installer
  3. When you're prompted, confirm that you want the installer to makechanges.

Set up the Chrome Remote Desktop service

You now generate a Windows command that starts the Chrome Remote Desktop serviceand links it to your Google Account.

  1. On your local computer, using the Chrome browser, go to theChrome Remote Desktop command line setup page.

  2. If you're not already signed in, sign in with a Google Account. This is theaccount that will be used for authorizing remote access.

  3. On the Set up another computer page, click Begin, then Next.

  4. Click Authorize.

    You need to allow Chrome Remote Desktop to access youraccount. If you approve, the page displays several command lines, one ofwhich is for Windows (Powershell) that looks like the following:

    & "${Env:PROGRAMFILES(X86)}\Google\Chrome Remote Desktop\CurrentVersion\remoting_start_host.exe" `--code="4/ENCODED_AUTHENTICATION_TOKEN" `--redirect-url="https://remotedesktop.google.com/_/oauthredirect" `--name=$Env:COMPUTERNAME
  5. Click Copy content_copy tocopy the command line to your clipboard.

  6. In your RDP session, at the Powershell prompt, paste the command line youjust copied and press Enter.

  7. When you're prompted, confirm that you want the application to makechanges.

  8. When you're prompted, enter a 6-digit PIN. This number will be used foradditional authorization when you connect later.

    After the command completes, your remote desktop service has started.

  9. Close the Powershell window.

  10. Close the RDP session.

You can now connect to the VM using Chrome Remote Desktop.

Non-interactive installation

In this approach, you configure the VM instance to have astartup scriptthat runs when the VM is created.

With this approach, the VM does not need to be directly accessible from theinternet, although it still needs access to the internet.

Authorize the Chrome Remote Desktop service

You now generate a Windows command that you use later in the specialize script.As part of this procedure, you provide authorization information that's includedin the command.

  1. On your local computer, using the Chrome browser, go to theChrome Remote Desktop command line setup page.

  2. If you're not already signed in, sign in with a Google Account. This is theaccount that will be used for authorizing remote access.

  3. Click Begin, and then click Next.

  4. Click Authorize.

  5. Allow Chrome Remote Desktop to access your account.

    The page now contains several command lines, one of which is for Windows(Cmd) that looks like the following:

    "%PROGRAMFILES(X86)%\Google\Chrome Remote Desktop\CurrentVersion\remoting_start_host.exe"--code="4/ENCODED_AUTHENTICATION_TOKEN"--redirect-url="https://remotedesktop.google.com/_/oauthredirect"--name=%COMPUTERNAME%

    The --code flag contains a unique short-lived OAuth token.

    The authorization code in the command line is valid for only a fewminutes, and you can use it only once.

    Keep this page open.

Copy the startup command to Cloud Shell

The next step is to create a file in your Cloud Shell instancethat contains the startup command that you just generated.

  1. Open Cloud Shell.

    Open Cloud Shell

  2. Create a file for the startup command:

    cat > crd-auth-command.txt
  3. Go to the page that has the Chrome Remote Desktop startup command and copythe Windows (Cmd) command line.

  4. In Cloud Shell paste the command to add it to the file.

  5. Press Enter to end the line, and then press Control-Dto close the file.

Create the startup script

  • Copy the following code block and paste it into Cloud Shell.

    cat << "EOF" > crd-sysprep-script.ps1<# .SYNOPSIS GCESysprep specialize script for unattended Chrome Remote Desktop installation.#>$ErrorActionPreference = 'stop'function Get-Metadata([String]$metadataName) { try { $value = (Invoke-RestMethod ` -Headers @{'Metadata-Flavor' = 'Google'} ` -Uri "http://metadata.google.internal/computeMetadata/v1/instance/attributes/$metadataName") } catch { # Report but ignore REST errors. Write-Host $_ } if ($value -eq $null -or $value.Length -eq 0) { throw "Metadata value for ""$metadataName"" not specified. Skipping Chrome Remote Desktop service installation." } return $value}# Get config from metadata#$crdCommand = Get-Metadata('crd-command')$crdPin = Get-Metadata('crd-pin')$crdName = Get-Metadata('crd-name')if ($crdPin -isNot [Int32] -or $crdPin -gt 999999 -or $crdPin -lt 0) { throw "Metadata ""crd-pin""=""$crdPin"" is not a 6 digit number. Skipping Chrome Remote Desktop service installation."}# Prefix $crdPin with zeros if required.$crdPin = $crdPin.ToString("000000");# Extract the authentication code and redirect URL arguments from the# remote dekstop startup command line.#$crdCommandArgs = $crdCommand.Split(' ')$codeArg = $crdCommandArgs | Select-String -Pattern '--code="[^"]+"'$redirectArg = $crdCommandArgs | Select-String -Pattern '--redirect-url="[^"]+"'if (-not $codeArg) { throw 'Cannot get --code= parameter from crd-command. Skipping Chrome Remote Desktop service installation.'}if (-not $redirectArg) { throw 'Cannot get --redirect-url= parameter from crd-command. Skipping Chrome Remote Desktop service installation.'}Write-Host 'Downloading Chrome Remote Desktop.'$installer = "$env:TEMP\chromeremotedesktophost.msi"$uri = 'https://dl.google.com/edgedl/chrome-remote-desktop/chromeremotedesktophost.msi'(New-Object Net.WebClient).DownloadFile($uri,"$installer")Write-Host 'Installing Chrome Remote Desktop.'& msiexec.exe /I $installer /qn /quiet | Out-DefaultRemove-Item $installerWrite-Host 'Starting Chrome Remote Desktop service.'& "${env:ProgramFiles(x86)}\Google\Chrome Remote Desktop\CurrentVersion\remoting_start_host.exe" ` $codeArg $redirectArg --name="$crdName" -pin="$crdPin" | Out-DefaultWrite-Host 'Downloading Chrome.'$installer = "$env:TEMP\chrome_installer.exe"$uri = 'https://dl.google.com/chrome/install/latest/chrome_installer.exe'(New-Object Net.WebClient).DownloadFile($uri,"$installer")Write-Host 'Installing Chrome.'& $installer /silent /install | Out-DefaultRemove-Item $installerEOF

    This code block is a PowerShell script that runs when the VM iscreated. It performs the following actions:

    • Downloads and installs the Chrome Remote Desktop host service.
    • Retrieves the following metadata parameters:
      • crd-command - the Windows authentication and startup command.
      • crd-pin - the 6-digit PIN used for additional authentication.
      • crd-name - the name for this instance.
    • Configures and starts the Chrome Remote Desktop host service.
    • Downloads and installs the Chrome browser.

Create a new Windows virtual machine

You now create a new Windows VM using the files you created earlierto configure and set up Chrome Remote Desktop.

For the purposes of this tutorial, the e2-medium machine type is used. If youare using this for your own environment, you may want to adjust the machinetype, name, region, boot disk size, or other settings.

  1. In Cloud Shell, set your preferred zone:

    ZONE=us-central1-bREGION=us-central1gcloud config set compute/zone "${ZONE}"
  2. Set a 6-digit PIN for additional authentication to Chrome Remote Desktop:

    CRD_PIN=your-pin

    Replace your-pin with a 6-digit number.

  3. Set a name for this VM instance:

    INSTANCE_NAME=crdhost
  4. Create the instance:

    gcloud compute instances create ${INSTANCE_NAME} \ --machine-type=e2-medium \ --scopes=cloud-platform \ --enable-display-device \ --image-family=windows-2022 \ --image-project=windows-cloud \ --boot-disk-size=50GB \ --boot-disk-device-name=${INSTANCE_NAME} \ --metadata=crd-pin=${CRD_PIN},crd-name=${INSTANCE_NAME} \ --metadata-from-file=crd-command=crd-auth-command.txt,sysprep-specialize-script-ps1=crd-sysprep-script.ps1

    This command creates a Windows Server 2022 virtual machine in the defaultVPC that has an attached display device (required for Chrome Remote Desktopon Windows VMs), a 50GB boot disk, and grants the instance full accessto Google Cloud APIs.

    The metadata values specify the specialize script, Windows startup commandline, and the parameters required to start the Chrome Remote Desktopservice.

Monitor the VM startup

You can verify that the startup script is successful by checking the messageslogged to the VM's serial port while it is being created.

  1. In Cloud Shell, display the messages logged during VM startup:

    gcloud compute instances tail-serial-port-output ${INSTANCE_NAME}

    If the Chrome Remote Desktop configuration is successful, you see thefollowing log lines:

    Found sysprep-specialize-script-ps1 in metadata.sysprep-specialize-script-ps1: Downloading Chrome Remote Desktop.sysprep-specialize-script-ps1: Installing Chrome Remote Desktop.sysprep-specialize-script-ps1: Downloading Chrome.sysprep-specialize-script-ps1: Installing Chrome.sysprep-specialize-script-ps1: Starting Chrome Remote Desktop service.Finished running specialize scripts.

    You might also see the following line:

    sysprep-specialize-script-ps1: ... Failed to read 'C:\ProgramData\Google\Chrome Remote Desktop\host_unprivileged.json'.: The system cannot find the path specified. (0x3)

    This is normal and can be ignored.

    If starting the Chrome Remote Desktop service fails, you see an errormessage indicating the problem, for example:

    sysprep-specialize-script-ps1: Couldn't start host: OAuth error.

    This error indicates that the OAuth token from the Chrome Remote Desktopauthentication page is no longer valid, either because it has already beenused, or because it has expired.

    To correct this error, either connect using RDP andperform an interactive setup as described previously, or delete the VM andretry the setup process.

    When you see the following message in the serial port monitor, the VM isready.

    GCEInstanceSetup: ------------------------------------------------------------GCEInstanceSetup: Instance setup finished. crdhost is ready to use.GCEInstanceSetup: ------------------------------------------------------------
  2. Press Control-C to stop displaying the startup messages.

Create a Windows user account

  1. In the Google Cloud console, go to the VM instances page.

    Go to the VM instances page

  2. Click the instance name crdhost to open the VM instancedetails page.

  3. Under Remote access, click Set Windows password, and then clickSet to create your account on the remote machine.

    This step generates a password for you. Make a note of the username andpassword or copy it to a secure temporary file.

Connect to the VM instance with Chrome Remote Desktop

You can connect to the VM instance using the Chrome Remote Desktop webapplication.

  1. On your local computer, go to theChrome Remote Desktop website.

  2. Click Access my computer.

  3. If you're not already signed in to Google, sign in with the same GoogleAccount that you used to set up the Chrome Remote Desktop service.

    You see your new VM instance crdhost in the Remote Devices list.

  4. Click the name of the remote desktop instance.

  5. When you're prompted, enter the PIN that you created earlier, and thenclick the arrowarrow_forwardbutton to connect.

    You are now connected to the Windows login screen on your remoteCompute Engine instance.

  6. If you are prompted, always allow the Remote Desktop application to read yourclipboard and let you copy and paste between local and remoteapplications.

  7. Press any key, and enter the password for the Windows user thatyou generated earlier. Note that the default remote keyboard has aUS-English layout, so the characters entered may not match the characterson your local keyboard. You also cannot copy and paste the password.

You are now connected and logged in to the remote Windows desktop.

Improve the remote desktop experience

This section provides instructions for changing settings in orderto improve the remote desktop experience.

Install the Remote Desktop Chrome app

The Remote Desktop Chrome app gives a separate windowed experience and allowskeyboard shortcuts that would normally be intercepted by Chrome to be used onthe remote system.

If this app is not installed, do the following:

  1. Open the Session Options panel using the buttonchevron_leftthat appears when you move the mouse to the side of the window.
  2. In the Install App section, click Begin.
  3. Click Install.

The remote desktop session reopens in its own application window.

You can move any remote desktop sessions from a Chrome tab tothe app window by clicking the Open Withopen_in_newicon in the address bar.

Improve the screen resolution

The default remote desktop resolution can modified to better suit your localcomputers desktop resolution.

  1. Right-click the remote desktop's background and select Display Settings.
  2. In the Resolution drop-down list, select a different screen resolution.
  3. Confirm the new screen resolution in the dialog.

Re-enable the service

If you have mistakenly disabled connections to the remote instance in theclient app, you can reconfigure the service and re-enable it by following theinstructions inSet up the Chrome Remote Desktop Service.

Set up Chrome Remote Desktop for Windows on Compute Engine  |  Cloud Architecture Center  |  Google Cloud (2024)

References

Top Articles
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated:

Views: 6685

Rating: 5 / 5 (80 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.