Update and rename 1709

parent 262fc3ad
# My Retina Windows Templates for Packer
[![Build status](https://ci.appveyor.com/api/projects/status/76pea1oexae5ca05?svg=true)](https://ci.appveyor.com/project/StefanScherer/packer-windows)
### Introduction
This repository contains Windows templates that can be used to create boxes for Vagrant using Packer ([Website](https://www.packer.io)) ([Github](https://github.com/mitchellh/packer)).
This repository contains Windows templates that can be used to create boxes for
Vagrant using Packer ([Website](https://www.packer.io))
([Github](https://github.com/mitchellh/packer)).
This repo is a modified fork of the popular [joefitzgerald/packer-windows](https://github.com/joefitzgerald/packer-windows) repo.
This repo is a modified fork of the popular
[joefitzgerald/packer-windows](https://github.com/joefitzgerald/packer-windows)
repo.
Some of my enhancements are:
* Support of fullscreen Retina display on a MacBook Pro.
* WinRM, no more OpenSSH
* PowerShell attached to taskbar with new features enabled
* PowerShell attached to taskbar in desktop editions
### Packer Version
[Packer](https://github.com/mitchellh/packer/blob/master/CHANGELOG.md) `0.12.2` or greater is required.
[Packer](https://github.com/mitchellh/packer/blob/master/CHANGELOG.md) `1.1.2`
or greater is recommended.
### Windows Versions
The following Windows versions are known to work (built with VMware Fusion Pro 8.1.1):
The following Windows versions are known to work (built with VMware Fusion Pro
10.0.1):
* Windows 10
* Windows Server 2016
* Windows Server 2016 with Hyper-V and Docker -> see [docker-windows-box](https://github.com/StefanScherer/docker-windows-box) for an use case
* Windows 10
* Windows 10 1709
* Windows 10 Insider
* Windows Server
* Windows Server 2016 without and with Docker
* Windows Server 1709 without and with Docker
* Windows Server Insider without and with Docker
You may find other packer template files, but older versions of Windows doesn't work so nice with a Retina display.
You may find other packer template files, but older versions of Windows doesn't
work so nice with a Retina display.
### Windows Editions
All Windows Server versions are defaulted to the Server Standard edition. You can modify this by editing the Autounattend.xml file, changing the `ImageInstall`>`OSImage`>`InstallFrom`>`MetaData`>`Value` element (e.g. to Windows Server 2012 R2 SERVERDATACENTER).
All Windows Server versions are defaulted to the Server Standard edition. You
can modify this by editing the Autounattend.xml file, changing the
`ImageInstall`>`OSImage`>`InstallFrom`>`MetaData`>`Value` element (e.g. to
Windows Server 2012 R2 SERVERDATACENTER).
### Product Keys
The `Autounattend.xml` files are configured to work correctly with trial ISOs (which will be downloaded and cached for you the first time you perform a `packer build`). If you would like to use retail or volume license ISOs, you need to update the `UserData`>`ProductKey` element as follows:
The `Autounattend.xml` files are configured to work correctly with trial ISOs
(which will be downloaded and cached for you the first time you perform a
`packer build`). If you would like to use retail or volume license ISOs, you
need to update the `UserData`>`ProductKey` element as follows:
* Uncomment the `<Key>...</Key>` element
* Insert your product key into the `Key` element
If you are going to configure your VM as a KMS client, you can use the product keys at http://technet.microsoft.com/en-us/library/jj612867.aspx. These are the default values used in the `Key` element.
If you are going to configure your VM as a KMS client, you can use the product
keys at http://technet.microsoft.com/en-us/library/jj612867.aspx. These are the
default values used in the `Key` element.
### Using existing ISOs
If you have already downloaded the ISOs or would like to override them, set these additional variables:
- iso_url - path to existing ISO
- iso_checksum - md5sum of existing ISO (if different)
If you have already downloaded the ISOs or would like to override them, set
these additional variables:
* iso_url - path to existing ISO
* iso_checksum - md5sum of existing ISO (if different)
```
packer build -var 'iso_url=./server2016.iso' .\windows_2016.json
......@@ -51,7 +74,12 @@ packer build -var 'iso_url=./server2016.iso' .\windows_2016.json
### Windows Updates
The scripts in this repo will install all Windows updates – by default – during Windows Setup. This is a _very_ time consuming process, depending on the age of the OS and the quantity of updates released since the last service pack. You might want to do yourself a favor during development and disable this functionality, by commenting out the `WITH WINDOWS UPDATES` section and uncommenting the `WITHOUT WINDOWS UPDATES` section in `Autounattend.xml`:
The scripts in this repo will install all Windows updates – by default – during
Windows Setup. This is a _very_ time consuming process, depending on the age of
the OS and the quantity of updates released since the last service pack. You
might want to do yourself a favor during development and disable this
functionality, by commenting out the `WITH WINDOWS UPDATES` section and
uncommenting the `WITHOUT WINDOWS UPDATES` section in `Autounattend.xml`:
```xml
<!-- WITHOUT WINDOWS UPDATES -->
......@@ -92,35 +120,41 @@ Doing so will give you hours back in your day, which is a good thing.
These boxes use WinRM. There is no OpenSSH installed.
### Hyper-V Support
If you are running Windows 10, then you can also use these packerfiles to build a Hyper-V virtual machine. I have the ISO already downloaded to save time, and only have Hyper-V installed on my laptop, so I run:
If you are running Windows 10, then you can also use these packerfiles to build
a Hyper-V virtual machine. I have the ISO already downloaded to save time, and
only have Hyper-V installed on my laptop, so I run:
```
packer build --only hyperv-iso -var 'hyperv_switchname=Ethernet' -var 'iso_url=./server2016.iso' .\windows_2016_docker.json
```
You then can use this box with Vagrant to spin up a Hyper-V VM. Vagrant currently
needs some patches as well, see the script [install-vagrant.ps1](hyperv/scripts/install-vagrant.ps1)
how to patch Vagrant 1.8.4 to fix these issues.
You then can use this box with Vagrant to spin up a Hyper-V VM. Vagrant
currently needs some patches as well, see the script
[install-vagrant.ps1](hyperv/scripts/install-vagrant.ps1) how to patch Vagrant
1.8.4 to fix these issues.
### Using .box Files With Vagrant
The generated box files include a Vagrantfile template that is suitable for
use with Vagrant 1.7.4+, which includes native support for Windows and uses
WinRM to communicate with the box.
The generated box files include a Vagrantfile template that is suitable for use
with Vagrant 1.7.4+, which includes native support for Windows and uses WinRM to
communicate with the box.
Vagrant 1.8.4 does need some workarounds though:
- There is a bug in get_vm_status.ps1
- winrm-fs needs an update as well
See: https://github.com/PatrickLang/packer-windows/issues/1#issuecomment-230151622
These are fixed in 1.8.5, so upgrading is easiest.
* There is a bug in get_vm_status.ps1
* winrm-fs needs an update as well See:
https://github.com/PatrickLang/packer-windows/issues/1#issuecomment-230151622
These are fixed in 1.8.5, so upgrading is easiest.
Example Steps for Hyper-V:
```
vagrant box add windows_2016_docker windows_2016_docker_hyperv.box
vagrant init windows_2016_docker
vagrant up --provider hyperv
```
### Contributing
Pull requests welcomed, but normally should go to Joe's repo.
......@@ -9,4 +9,4 @@ packer build \
--var iso_checksum=ca1108d5be2c091bfb57e8f3db3be1e8baa9c32802131f7a6e43e63f7b596591 \
--var iso_checksum_type=sha256 \
--var autounattend=./tmp/1709/Autounattend.xml \
windows_server_1709.json
windows_server_1709_docker.json
{
"builders": [
{
"vm_name":"WindowsServer1709",
"vm_name": "WindowsServer1709",
"type": "hyperv-iso",
"disk_size": "{{user `disk_size`}}",
"boot_wait": "60s",
"guest_additions_mode":"disable",
"guest_additions_mode": "disable",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"floppy_files": [
"{{user `autounattend`}}",
"./floppy/WindowsPowershell.lnk",
"./floppy/PinTo10.exe",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/docker/enable-winrm.ps1",
"./scripts/docker/2016/install-containers-feature.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1"
],
"communicator":"winrm",
"communicator": "winrm",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout" : "{{user `winrm_timeout`}}",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"winrm_timeout": "{{user `winrm_timeout`}}",
"shutdown_command":
"shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"ram_size": 2048,
"cpu": 2,
"switch_name":"{{user `hyperv_switchname`}}",
"enable_secure_boot":true,
"enable_virtualization_extensions":true
"switch_name": "{{user `hyperv_switchname`}}",
"enable_secure_boot": true,
"enable_virtualization_extensions": true
},
{
"vm_name":"WindowsServer1709",
"vm_name": "WindowsServer1709",
"type": "vmware-iso",
"communicator": "winrm",
"iso_url": "{{user `iso_url`}}",
......@@ -43,7 +42,8 @@
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout": "{{user `winrm_timeout`}}",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"shutdown_command":
"shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "windows9srv-64",
"disk_size": "{{user `disk_size`}}",
"version": 11,
......@@ -52,11 +52,9 @@
"floppy_files": [
"{{user `autounattend`}}",
"./floppy/WindowsPowershell.lnk",
"./floppy/PinTo10.exe",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/docker/enable-winrm.ps1",
"./scripts/docker/2016/install-containers-feature.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1"
],
......@@ -70,7 +68,7 @@
}
},
{
"vm_name":"WindowsServer1709",
"vm_name": "WindowsServer1709",
"type": "virtualbox-iso",
"communicator": "winrm",
"iso_url": "{{user `iso_url`}}",
......@@ -81,67 +79,35 @@
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout": "{{user `winrm_timeout`}}",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"shutdown_command":
"shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "Windows2012_64",
"guest_additions_mode": "disable",
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"{{user `autounattend`}}",
"./floppy/WindowsPowershell.lnk",
"./floppy/PinTo10.exe",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/docker/enable-winrm.ps1",
"./scripts/docker/2016/install-containers-feature.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1"
],
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
["modifyvm", "{{.Name}}", "--memory", "2048"],
["modifyvm", "{{.Name}}", "--cpus", "2"]
]
}
],
"provisioners": [
{
"type": "windows-shell",
"scripts": [
"./scripts/vm-guest-tools.bat",
"./scripts/enable-rdp.bat"
]
},
{
"type": "powershell",
"scripts": [
"./scripts/docker/2016/install-containers-feature.ps1"
]
},
{
"type": "windows-restart",
"restart_timeout": "{{user `restart_timeout`}}"
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": ["./scripts/vm-guest-tools.bat", "./scripts/enable-rdp.bat"]
},
{
"type": "powershell",
"scripts": [
"./scripts/docker/add-docker-group.ps1",
"./scripts/docker/set-winrm-automatic.ps1",
"./scripts/docker/2016/install-docker-ee-preview.ps1",
"./scripts/docker/docker-pull-1709-async.ps1",
"./scripts/docker/open-docker-insecure-port.ps1",
"./scripts/docker/open-docker-swarm-ports.ps1",
"./scripts/docker/remove-docker-key-json.ps1",
"./scripts/docker/disable-windows-defender.ps1"
]
"scripts": ["./scripts/debloat-windows.ps1"]
},
{
"type": "windows-restart",
......@@ -149,8 +115,11 @@
},
{
"type": "windows-shell",
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
"scripts": [
"./scripts/set-winrm-automatic.bat",
"./scripts/compile-dotnet-assemblies.bat",
"./scripts/uac-enable.bat",
"./scripts/compact.bat"
]
}
......@@ -168,11 +137,14 @@
"disk_size": "61440",
"disk_type_id": "1",
"vhv_enable": "false",
"manually_download_iso_from": "https://my.visualstudio.com/downloads?pid=2347",
"iso_url": "https://software-download.microsoft.com/pr/en_windows_server_version_1709_x64_dvd_100090904.iso",
"manually_download_iso_from":
"https://my.visualstudio.com/downloads?pid=2347",
"iso_url":
"https://software-download.microsoft.com/pr/en_windows_server_version_1709_x64_dvd_100090904.iso",
"iso_checksum_type": "sha256",
"iso_checksum": "ca1108d5be2c091bfb57e8f3db3be1e8baa9c32802131f7a6e43e63f7b596591",
"autounattend": "./answer_files/1709/Autounattend.xml",
"iso_checksum":
"ca1108d5be2c091bfb57e8f3db3be1e8baa9c32802131f7a6e43e63f7b596591",
"autounattend": "./answer_files/server_1709/Autounattend.xml",
"restart_timeout": "5m",
"winrm_timeout": "2h"
}
......
{
"builders": [
{
"vm_name": "WindowsServer1709Docker",
"type": "hyperv-iso",
"disk_size": "{{user `disk_size`}}",
"boot_wait": "60s",
"guest_additions_mode": "disable",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"floppy_files": [
"{{user `autounattend`}}",
"./floppy/WindowsPowershell.lnk",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/docker/enable-winrm.ps1",
"./scripts/docker/2016/install-containers-feature.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1"
],
"communicator": "winrm",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout": "{{user `winrm_timeout`}}",
"shutdown_command":
"shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"ram_size": 2048,
"cpu": 2,
"switch_name": "{{user `hyperv_switchname`}}",
"enable_secure_boot": true,
"enable_virtualization_extensions": true
},
{
"vm_name": "WindowsServer1709Docker",
"type": "vmware-iso",
"communicator": "winrm",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": "{{user `headless`}}",
"boot_wait": "60s",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout": "{{user `winrm_timeout`}}",
"shutdown_command":
"shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "windows9srv-64",
"disk_size": "{{user `disk_size`}}",
"version": 11,
"vnc_port_min": 5900,
"vnc_port_max": 5980,
"floppy_files": [
"{{user `autounattend`}}",
"./floppy/WindowsPowershell.lnk",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/docker/enable-winrm.ps1",
"./scripts/docker/2016/install-containers-feature.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1"
],
"vmx_data": {
"RemoteDisplay.vnc.enabled": "false",
"RemoteDisplay.vnc.port": "5900",
"memsize": "2048",
"numvcpus": "2",
"scsi0.virtualDev": "lsisas1068",
"vhv.enable": "{{user `vhv_enable`}}"
}
},
{
"vm_name": "WindowsServer1709Docker",
"type": "virtualbox-iso",
"communicator": "winrm",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": "{{user `headless`}}",
"boot_wait": "60s",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout": "{{user `winrm_timeout`}}",
"shutdown_command":
"shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"guest_os_type": "Windows2012_64",
"guest_additions_mode": "disable",
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"{{user `autounattend`}}",
"./floppy/WindowsPowershell.lnk",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/docker/enable-winrm.ps1",
"./scripts/docker/2016/install-containers-feature.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1"
],
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "2048"],
["modifyvm", "{{.Name}}", "--cpus", "2"]
]
}
],
"provisioners": [
{
"type": "windows-shell",
"scripts": ["./scripts/vm-guest-tools.bat", "./scripts/enable-rdp.bat"]
},
{
"type": "powershell",
"scripts": ["./scripts/docker/2016/install-containers-feature.ps1"]
},
{
"type": "windows-restart",
"restart_timeout": "{{user `restart_timeout`}}"
},
{
"type": "powershell",
"scripts": [
"./scripts/docker/add-docker-group.ps1",
"./scripts/docker/set-winrm-automatic.ps1",
"./scripts/docker/2016/install-docker-ee-preview.ps1",
"./scripts/docker/docker-pull-1709-async.ps1",
"./scripts/docker/open-docker-insecure-port.ps1",
"./scripts/docker/open-docker-swarm-ports.ps1",
"./scripts/docker/remove-docker-key-json.ps1",
"./scripts/docker/disable-windows-defender.ps1"
]
},
{
"type": "windows-restart",
"restart_timeout": "{{user `restart_timeout`}}"
},
{
"type": "windows-shell",
"scripts": [
"./scripts/compile-dotnet-assemblies.bat",
"./scripts/compact.bat"
]
}
],
"post-processors": [
{
"type": "vagrant",
"keep_input_artifact": false,
"output": "windows_server_1709_docker_{{.Provider}}.box",
"vagrantfile_template": "vagrantfile-windows_2016.template"
}
],
"variables": {
"headless": "false",
"disk_size": "61440",
"disk_type_id": "1",
"vhv_enable": "false",
"manually_download_iso_from":
"https://my.visualstudio.com/downloads?pid=2347",
"iso_url":
"https://software-download.microsoft.com/pr/en_windows_server_version_1709_x64_dvd_100090904.iso",
"iso_checksum_type": "sha256",
"iso_checksum":
"ca1108d5be2c091bfb57e8f3db3be1e8baa9c32802131f7a6e43e63f7b596591",
"autounattend": "./answer_files/server_1709/Autounattend.xml",
"restart_timeout": "5m",
"winrm_timeout": "2h"
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment