Creating a Windows Image

This guide shows you how to create a Windows operating system image that you can use to start Windows instances on Google Compute Engine. To learn how to create a Windows instance, see Creating a New Windows Instance.

This page does not describe how to import your own Windows Server boot disk image. Importing your own Windows boot disk image is not supported. To create Windows Server instances or SQL Server instances on Compute Engine, you can either migrate an entire Windows Server system using the VM Migration Service, or use one of the public images to create Windows Server instances. It is not possible to import Windows desktop images, such as Windows 7 images.

Creating a Windows image

You can configure your Windows operating system and create custom operating system images that you can use to start new Windows instances. Images are useful for saving configuration settings of your operating system and reusing the same configuration for other instances. However, if you want to make scheduled backups of your data instead, use persistent disk snapshots.

To create an image, use the following steps:

  1. Deleting the instance
  2. Creating the image

Deleting the instance

  1. Log in to your Windows instance and open PowerShell or Command Prompt as an administrator.
  2. Use GCESysprep to prepare your system for duplication:

    GCESysprep
    

    This will shut down the instance and close the remote desktop connection.

  3. Set the auto-delete state of the root persistent disk to false so that it is not automatically deleted when you delete the instance.

  4. Delete the instance.

Creating the image

Console

  1. Go to the Create a new image page in the Cloud Platform Console.

    Create a new image

  2. Give the image a name.
  3. Choose a source disk with a Windows operating system to create the snapshot form.
  4. Click Create.

gcloud

Use the gcloud compute with the images create, and provide the source persistent disk to make an image of.

gcloud compute images create example-image --source-disk [DISK_NAME] --source-disk-zone [ZONE]
  • [DISK_NAME] is the name of the source disk to create the image from.
  • [ZONE] is the zone of the disk.

When you run this command, gcloud compute creates a new image based on the persistent disk you provided and adds it to your collection. You can confirm that your image was successfully created by running:

gcloud compute images list

API

Make a POST request to the images().insert method, with a sourceDisk URL in the request body.

POST https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/images

{
  "name": "[IMAGE_NAME]",
  "sourceDisk": "zones/[ZONE]/disks/[DISK_NAME]"
}

where:

  • [PROJECT_ID] is the project ID for this request.
  • [IMAGE_NAME] is the name to give this image.
  • [ZONE] is the zone of the source disk to create an image from.
  • [DISK_NAME] is the name of the source disk.

For more information about adding images, see the images reference.

Updating Windows agents and scripts

Compute Engine occasionally releases new Windows images with the latest agents and scripts. These items assist Windows instances with startup and shutdown processes, account management, and address management.

Since Windows image version v20160112, the Windows agent updates itself with upstream releases. You can disable these agent updates by setting the disable-agent-updates instance metadata key to true. If you have instances that are based on older image releases, you can manually update the Windows agent of those instances.

What's next

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Compute Engine Documentation