Capturing VM screenshots


This page describes how to capture a screenshot from a virtual machine (VM) instance by using the VM screenshot tool.

Capturing a screenshot from a VM can help you troubleshoot a VM that is not otherwise accessible. For example, a VM might not be accessible if it is booting or has a disk image that is corrupted.

Windows-based operating systems

VM screenshots can help to troubleshoot failed RDP connections to Windows VMs, by identifying if the instance has started successfully. For information about troubleshooting RDP connections, see Troubleshooting RDP.

Privacy considerations with remote desktop clients

The VM screenshot tool uses the display adapter of the VM to capture a screenshot of the local console session through a remote desktop client. Capturing a screenshot through the local console session might capture sensitive information from the user's desktop or browser.

If you are concerned about exposing sensitive information as part of a screenshot, configure your respective remote desktop client in the following way so that it does not use the local console session:

Before sharing screenshots with Google Support, make sure to review them for sensitive information.

Before you begin

  • Enable virtual displays on your VM.
  • If you haven't already, then set up authentication. Authentication is the process by which your identity is verified for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:

    Select the tab for how you plan to use the samples on this page:

    Console

    When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

    gcloud

    1. Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init
    2. Set a default region and zone.

    REST

    To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.

      Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init

    For more information, see Authenticate for using REST in the Google Cloud authentication documentation.

Limitations

  • The instance must be in the RUNNING life cycle state.

  • The maximum rate for capturing screenshots is 20 per second, which is the API rate limit.

  • You can't initiate a screenshot while one is in progress.

  • You can capture one screenshot at a time.

Capturing a screenshot from a VM

Use the following procedures to capture a screenshot from a VM.

Console

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

    Go to VM instances

  2. From the VM instances page, click the name of the VM instance to capture a screenshot from.

  3. On the VM instance details page, click the Screenshot tab.

  4. Click Refresh to generate a screenshot from the VM. If you have not enabled a virtual display, the Google Cloud console does not show a screenshot.

gcloud

Capture a screenshot from a VM by using the gcloud compute instances get-screenshot command:

gcloud compute instances get-screenshot VM_NAME \
  --destination=JPEG_FILENAME \
  --zone=ZONE

Replace the following:

  • VM_NAME: name of the VM to capture a screenshot from.

  • JPEG_FILENAME: optional filename of the jpeg for the screenshot output. If you do not specify a filename, the raw jpeg data is sent to standard output (stdout).

  • ZONE: zone of the VM to capture a screenshot from.

REST

With the Compute Engine API, capture a screenshot from a VM by using the instances.getScreenshot request:

GET https://compute.googleapis.com/compute/v1/projects/PROJECT/zo
nes/ZONE/instances/VM_NAME/screenshot

Replace the following:

  • PROJECT: ID of the project containing the VM to capture a screenshot from.

  • ZONE: zone containing the project.

  • VM_NAME: name of the VM to capture a screenshot from.

Example VM screenshots

The Compute Engine UEFI loading the boot manager

The following screenshot shows a Windows Server VM that is unavailable while the boot manager is loading:

The UEFI loading the boot manager

Windows Server 2016 Datacenter performing updates

The following screenshot shows a Windows Server 2016 VM that is unavailable while completing updates:

Windows Server 2016 Datacenter performing updates.

Windows Server 2016 loading system services

The following screenshot shows a Windows Server 2016 VM that is unavailable while loading system services:

Windows Server 2016 loading system services.

Login screen for Windows Server 2016 Datacenter

The following screenshot shows a Windows Server 2016 VM that has completed startup and is ready to login:

Login screen for Windows Server 2016 Datacenter.

Sysprep process of Windows Server 2019 Core

The following screenshot shows the sysprep process of a Windows Server 2019 Core VM instance:

Sysprep process for Windows Server 2019 Core.

Blue screen error from Windows Server 2016 Datacenter

The following screenshot shows a blue screen error from a Windows Server 2016 Datacenter VM instance:

Blue screen from Windows Server 2016 Datacenter.

What's next