From f15925b017083b7035d2be8f9a545d022993a380 Mon Sep 17 00:00:00 2001 From: Rickard von Essen Date: Tue, 28 Mar 2017 17:27:57 +0200 Subject: [PATCH] builder/googlecompute: Added Windows example to the docs. Closes: #4713 --- .../docs/builders/googlecompute.html.md | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/website/source/docs/builders/googlecompute.html.md b/website/source/docs/builders/googlecompute.html.md index 6b3924874..bbfc4dcc7 100644 --- a/website/source/docs/builders/googlecompute.html.md +++ b/website/source/docs/builders/googlecompute.html.md @@ -109,6 +109,32 @@ is assumed to be the path to the file containing the JSON. } ``` +### Windows Example + +Running WinRM requires that it is opened in the firewall and that the VM enables WinRM for the +user used to connect in a startup-script. + +``` {.json} +{ + "builders": [{ + "type": "googlecompute", + "account_file": "account.json", + "project_id": "my project", + "source_image": "windows-server-2016-dc-v20170227", + "disk_size": "50", + "machine_type": "n1-standard-1", + "communicator": "winrm", + "winrm_username": "packer_user", + "winrm_insecure": true, + "winrm_use_ssl": true, + "metadata": { + "windows-startup-script-cmd": "winrm quickconfig -quiet & net user /add packer_packer & net localgroup administrators packer_user /add & winrm set winrm/config/service/auth @{Basic=\"true\"}" + }, + "zone": "us-central1-a" + }] +} +``` + ## Configuration Reference Configuration options are organized below into two categories: required and @@ -235,7 +261,10 @@ such support is implemented, startup scripts should be robust, as an image will when a startup script fails. ### Windows -Startup scripts do not work on Windows builds, at this time. + +A Windows startup script can only be provided via the 'windows-startup-script-cmd' instance +creation `metadata` field. The builder will _not_ wait for a Windows startup scripts to +terminate. You have to ensure that it finishes before the instance shuts down. ### Logging Startup script logs can be copied to a Google Cloud Storage (GCS) location specified via the