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
- In the Google Cloud console, go to the VM Instances page:
Go to VM Instances
Click Create.
Set the instance name to
crdhost
.Enable the Enable display device checkbox because Chrome RemoteDesktop requires a display device on Windows VMs.
Under Boot disk, click Change to open the Bootdisk panel.
From the Operating system list, select Windows Server.
From the Version list, select Windows Server 2022 Datacenter.
Click Select to close the panel.
Click Create.
Cloud Shell
Open Cloud Shell.
Open Cloud Shell
Set your preferred zone:
ZONE=us-central1-bREGION=us-central1gcloud config set compute/zone "${ZONE}"
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
In the Google Cloud console, go to the VM instances page.
Go to the VM instances page
Make sure a green check mark checkis displayed next to the name of your
crdhost
instance,indicating that the instance is ready.Click the instance name
crdhost
to open the VM instancedetails page.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.
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.
When your RDP client prompts for a password, enter the passwordthat you generated earlier.
When you're prompted whether you want your computer discoverable byother PCs and devices on the network, click No.
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 Desktop serviceon the VM instance.
In your RDP session, click Start on the Windows taskbar,type
PowerShell
, and then select the Windows PowerShell app.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
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.
On your local computer, using the Chrome browser, go to theChrome Remote Desktop command line setup page.
If you're not already signed in, sign in with a Google account. This is theaccount that will be used for authorizing remote access.
On the Set up another computer page, click Begin, then Next.
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
Click Copy content_copy tocopy the command line to your clipboard.
In your RDP session, at the Powershell prompt, paste the command line youjust copied and press Enter.
When you're prompted, confirm that you want the application to makechanges.
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.
Close the Powershell window.
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.
On your local computer, using the Chrome browser, go to theChrome Remote Desktop command line setup page.
If you're not already signed in, sign in with a Google Account. This is theaccount that will be used for authorizing remote access.
Click Begin, and then click Next.
Click Authorize.
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.
Open Cloud Shell.
Open Cloud Shell
Create a file for the startup command:
cat > crd-auth-command.txt
Go to the page that has the Chrome Remote Desktop startup command and copythe Windows (Cmd) command line.
In Cloud Shell paste the command to add it to the file.
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.
In Cloud Shell, set your preferred zone:
ZONE=us-central1-bREGION=us-central1gcloud config set compute/zone "${ZONE}"
Set a 6-digit PIN for additional authentication to Chrome Remote Desktop:
CRD_PIN=your-pin
Replace your-pin with a 6-digit number.
Set a name for this VM instance:
INSTANCE_NAME=crdhost
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) and 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.
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.sysprep-specialize-script-ps1 exit status 0Finished running specialize scripts.
If the Chrome Remote Desktop configuration fails, you see an error messageindicating 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 via 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: ------------------------------------------------------------
Press Control-C to stop displaying the startup messages.
Create a Windows user account
In the Google Cloud console, go to the VM instances page.
Go to the VM instances page
Click the instance name
crdhost
to open the VM instancedetails page.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.
On your local computer, go to theChrome Remote Desktop web site.
Click Access my computer.
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.Click the name of the remote desktop instance.
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.
If you are prompted, always allow the Remote Desktop application to read yourclipboard and let you copy and paste between local and remoteapplications.
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:
- Open the Session Options panel using the buttonchevron_leftthat appears when you move the mouse to the side of the window.
- In the Install App section, click Begin.
- 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 URL bar.
Improve the screen resolution
The default remote desktop resolution can modified to better suit your localcomputers desktop resolution.
- Right-click the remote desktop's background and select Display Settings.
- In the Resolution drop-down list, select a different screen resolution.
- 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 inSetting up the Chrome Remote Desktop Service.
FAQs
How do I Create a Remote Desktop in GCP? ›
Windows VMs on Compute Engine can be remotely accessed using the RDP. The simplest way to use RDP with GCE instances is by navigating to the instances list in Cloud Console using a Chrome browser and clicking RDP. This will launch an RDP session using the Chrome RDP for Google Cloud Platform Chrome extension.
Do I need Google account for Chrome Remote Desktop? ›To use Chrome Remote Desktop, you must first register a Google account if you don't already have one.
How do I setup a Windows virtual machine on Google Cloud? ›- In the Google Cloud console, go to the Create an instance page. Go to Create an instance.
- For Boot disk, select Change, and do the following: On the Public images tab, choose a Windows Server operating system. Click Select.
- To create the VM, click Create.
- On the device you want to connect to, select Start and then click the Settings icon on the left.
- Select the System group followed by the Remote Desktop item.
- Use the slider to enable Remote Desktop.
- It is also recommended to keep the PC awake and discoverable to facilitate connections.
- Click the Start menu from your desktop, and then click Control Panel.
- Click System and Security once the Control Panel opens.
- Click Allow remote access, located under the System tab.
- Click Select Users, located in the Remote Desktop section of the Remote tab.
- No built-in instant chat. ...
- Won't work without the Google Chrome web browser. ...
- No drag-and-drop file transfer. ...
- No multi-session handling. ...
- Session permission has to be renewed every 30 minutes. ...
- No monitor resolution scaling. ...
- Inexperienced users often find it challenging to use.
If you're having problems with Chrome Remote Desktop, try these tips: You need to be connected to the Internet to share or access a computer. If the page won't open, check your computer's network settings. Antivirus software might prevent you from using Chrome Remote Desktop.
Is Chrome Remote Desktop no longer supported? ›The Chrome Remote Desktop client was originally a Chrome extension from the Chrome Web Store requiring Google Chrome; the extension is deprecated, and a web portal is available at remotedesktop.google.com. The browser must support WebRTC and other unspecified "modern web platform features".
How do I log into a VM with RDP? ›- On the tile for your VM, select the Connect icon. ...
- If you're connecting to a Linux VM, select the Connect via RDP option.
- After the RDP connection file download finishes, open the RDP file to launch the RDP client.
Microsoft RDP is a supported display protocol for remote desktops that use virtual machines, physical machines, or shared session desktops on an RDS host. (Only the PCoIP display protocol and the VMware Blast display protocol are supported for published applications.)
How do I access my GCP Windows VM? ›
- In the Google Cloud console, go to the VM instances page. ...
- Under the Name column, click the name of your VM instance.
- Under the Remote access section, click Set Windows password.
- Specify a username, then click Set to generate a new password for this Windows Server VM.
You can enable nested virtualization on VM by creating a custom image with a special license key that enables VMX on the L1 VM. The license key does not incur additional charges. Create a boot disk from a public image or from a custom image.
How do I get root access to my Google virtual machine? ›Connect as the root user
Connect to VMs as the root user by using the gcloud compute ssh command with root@ specified before the VM name: In the Google Cloud console, activate Cloud Shell. At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt.
- Step 1: Check if your system is compatible. Before you can enable Hyper-V on your Windows 11 machine, you need to make sure that your system is compatible. ...
- Step 2: Enable Hyper-V on Windows 11. ...
- Step 3: Download the Windows 11 image. ...
- Step 4: Configure the VM settings. ...
- Step 5: Deploy the Virtual Machine.
In the Google Cloud console, go to the Dataform page. Select the repository where you want to create the new development workspace. On your repository page, click Create development workspace.
What is the command to create virtual machine in GCP? ›In the Google Cloud console, go to the VM instances page. Select your project and click Continue. Click Create instance. Specify a Name for your VM.
Can multiple people use Google Remote Desktop? ›Can multiple users use Chrome Remote Desktop? Yes, multiple users can use Chrome Remote Desktop to access the same physically distant servers from their Chromebook or another local computer. Multiple individuals can be set up in Chrome Remote Desktop to enable connectivity to remote machines.