Windows agents and scripts for Google Compute Engine images.
Clone or download
zmarano Merge pull request #160 from adjackura/development
Add support for Server 2019
Latest commit 3ad4aca Oct 4, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
GCEWindowsAgent Allow building where GOOS is not Windows/Linux (#152) Aug 13, 2018
certgen Rewrite the C# bits in Go (#87) Apr 12, 2017
examples Add Go Windows auth example (#139) May 11, 2018
logger Allow building where GOOS is not Windows/Linux (#152) Aug 13, 2018
metadata_scripts Fix formatting (ran go fmt ./...) (#151) Aug 30, 2018
sysprep Add support for Server 2019 Oct 3, 2018
third_party/vss Add components for Vss PD snapshots. (#63) Jul 21, 2016
vendor/ Drop IPV6 references as they were causing issues with CreateUnicastIp… Jul 24, 2017 Vendor external non Google dependencies (#100) May 3, 2017
.travis.yml GCEWindowsAgent: allow specifying hash function for password reset (#145 Jul 17, 2018 Renamed to Jun 3, 2015
LICENSE Update LICENSE (#126) Jan 8, 2018 Update README to fix #130 Mar 21, 2018 Allow building where GOOS is not Windows/Linux (#152) Aug 13, 2018
agent_install.ps1 Update config file link, import module with static path (#117) Jul 31, 2017
agent_uninstall.ps1 Rewrite the C# bits in Go (#87) Apr 12, 2017
auto_updater.ps1 New VSS package in autoupdater, updates to other packages (#114) Jul 27, 2017
auto_updater_install.ps1 Vendor external non Google dependencies (#100) May 3, 2017
auto_updater_uninstall.ps1 Rewrite the C# bits in Go (#87) Apr 12, 2017
certgen.goospec Vendor external non Google dependencies (#100) May 3, 2017
gce_base.psm1 Supress errors that may occur when clearing event logs (#146) Jul 18, 2018
google-compute-engine-auto-updater.goospec New VSS package in autoupdater, updates to other packages (#114) Jul 27, 2017
google-compute-engine-metadata-scripts.goospec Always print "Finished..." at the end of metadata scripts (#153) Aug 15, 2018
google-compute-engine-powershell.goospec Supress errors that may occur when clearing event logs (#146) Jul 18, 2018
google-compute-engine-sysprep.goospec Add support for Server 2019 Oct 3, 2018
google-compute-engine-windows.goospec GCEWindowsAgent: Use NetUserGetInfo to lookup user accounts Jul 30, 2018 A bunch of tweaks and fixes to the new agent and installers. (#93) Apr 14, 2017
metadata_scripts_install.ps1 Fix install locations (#99) May 2, 2017
metadata_scripts_uninstall.ps1 Fix install locations (#99) May 2, 2017
sysprep_install.ps1 Fix install locations (#99) May 2, 2017
sysprep_uninstall.ps1 Fix install locations (#99) May 2, 2017

Windows Guest Environment for Google Compute Engine

This repository stores the collection of Windows packages installed on Google supported Compute Engine images.

Table of Contents


The Windows guest environment is the Google provided configuration and tooling inside of a Google Compute Engine (GCE) virtual machine. The metadata server is a communication channel for transferring information from a client into the guest. The Windows guest environment includes a set of scripts and binaries that read the content of the metadata server to make a virtual machine run properly on Google Compute Engine.



The agent is configurable through metadata or a local config file.

Account Setup

The agent handles creating user accounts and setting/resetting passwords.

IP Forwarding

The agent uses IP forwarding metadata to setup or remove IP routes.

  • Only IPv4 IP addresses are currently supported.

Windows Failover Cluster Support

The agent can monitor the active node in the Windows Failover Cluster and coordinate with GCP Internal Load Balancer to forward all cluster traffic to the expected node.

The following fields on instance metadata or instance_configs.cfg can control the behavior:

  • enable-wsfc: If set to true, all IP forwarding info will be ignored and agent will start responding to the health check port. Default false.
  • wsfc-agent-port: The port which the agent will respond to health checks. Default 59998.
  • wsfc-addrs: A comma separated list of IP address. This is an advanced setting to enable user have both normal forwarding IPs and cluster IPs on the same instance. If set, agent will only skip-auto configuring IPs in the list. Default empty.

Main code can be found here: wsfc.go

Instance Setup

instance_setup.ps1 is configured by GCE sysprep to run on VM first boot. The script performs the following tasks:

  • Set the hostname to the instance name.
  • Runs user provided 'specialize' startup script.
  • Activates Windows using a KMS server.
  • Sets up RDP and WinRM to allow remote login.

Metadata Scripts

Metadata scripts implement support for running user provided startup scripts and shutdown scripts.

Packaging and Package Distribution

The guest code is packaged in GooGet packages and published to Google Cloud repositories.

We build and install the following packages for the Windows guest environment:

  • google-compute-engine-windows - Windows agent executable.
  • google-compute-engine-sysprep - Utilities for running sysprep on new Windows virtual machines.
  • google-compute-engine-metadata-scripts - Windows exe and cmd files to run startup and shutdown scripts.
  • google-compute-engine-powershell - PowerShell module for common functions used by other packages.
  • google-compute-engine-auto-updater - Automatic updater for core Google packages.
  • google-compute-engine-vss - Google Compute Engine VSS agent and provider

The package build specs are published in this project.

To setup GooGet and install packages run the following commands in an elevated PowerShell prompt:

Download and install GooGet:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -OutFile $env:temp\googet.exe
& "$env:temp\googet.exe" -root C:\ProgramData\GooGet -noconfirm install -sources googet
Remove-Item "$env:temp\googet.exe"

On installation GooGet adds content to the system environment, launch a new PowerShell console after installation or provide the full path to googet.exe (C:\ProgramData\GooGet\googet.exe).

Add the google-compute-engine-stable repo, this must be done in a new console if you just installed GooGet:

googet addrepo google-compute-engine-stable

Install the core packages google-compute-engine-windows, google-compute-engine-metadata-scripts,google-compute-engine-sysprep, and google-compute-engine-vss.

googet -noconfirm install google-compute-engine-windows google-compute-engine-sysprep google-compute-engine-metadata-scripts google-compute-engine-vss

Install optional packages, google-compute-engine-auto-updater:

googet -noconfirm install google-compute-engine-auto-updater

You can view available packages using the googet available and installed packages using the googet installed command. Running googet update will update to the latest versions available. To view additional commands run googet help.


Have a patch that will benefit this project? Awesome! Follow these steps to have it accepted.

  1. Please sign our Contributor License Agreement.
  2. Fork this Git repository and make your changes.
  3. Create a Pull Request.
  4. Incorporate review feedback to your changes.
  5. Accepted!


All files in this repository are under the Apache License, Version 2.0 unless noted otherwise.