...
 
Commits (309)
.DS_Store
/iso/*
!/iso/README.md
/output-hyperv-iso/
/output-vmware/
/output-vmware-iso/
/output-vmware-vmx/
......
## Unreleased
* Fixed issue with Console Output (#245)
* Added a Parallels builder for Windows 2019 with Docker
## v1.24 (June 8th, 2015)
......
FROM mcr.microsoft.com/windows:1809 AS makeiso
WORKDIR C:/source
COPY . .
RUN powershell -NoProfile -ExecutionPolicy unrestricted -file make_unattend_iso.ps1
FROM mcr.microsoft.com/windows/servercore:ltsc2019
ENV chocolateyUseWindowsCompression false
RUN powershell -NoProfile -ExecutionPolicy unrestricted -Command \
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); \
choco feature disable --name showDownloadProgress
RUN choco install -y packer
RUN powershell -Command Install-WindowsFeature Hyper-V-PowerShell
COPY --from=makeiso C:/source C:/source
WORKDIR C:/source
RUN powershell -File test.ps1
## Windows - Amazon Import AMIs
VirtualBox Hypervisor is used to build a local vm and then imported as an AMI using
the amazon import service https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html.
## Requirements
* Set your aws credentials on the default location `~/.aws/credentials`. https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
* Packer 1.2.3+. https://www.packer.io/downloads.html
* S3 Bucket with the necessary permissions. Set the `AWS_S3_BUCKET` environment variable.
* If you use SAML authentication make sure you set `profile` in the amazon-import post-processor.
* `vm-guest-tools` provisioner is removed.
You may wonder what's this `Dockerfile` for. I have tested the Windows Server 2019 insider 17744 build
to see if I can run the `test.ps1` script that checks all packer templates with `packer validate` in a Windows container.
```
docker build -t packervalidate .
```
If the Docker image can be built then all packer templates have no errors.
# My Retina Windows Templates for Packer
# Windows Templates for Packer
[![Build status](https://ci.appveyor.com/api/projects/status/76pea1oexae5ca05?svg=true)](https://ci.appveyor.com/project/StefanScherer/packer-windows)
......@@ -16,27 +16,26 @@ Some of my enhancements are:
* Support of fullscreen Retina display on a MacBook Pro.
* WinRM, no more OpenSSH
* PowerShell attached to taskbar in desktop editions
### Packer Version
[Packer](https://github.com/mitchellh/packer/blob/master/CHANGELOG.md) `1.1.3` is recommended.
[Packer](https://github.com/mitchellh/packer/blob/master/CHANGELOG.md) `1.3.3` is recommended.
### Windows Versions
The following Windows versions are known to work (built with VMware Fusion Pro
10.1.1):
11.0.2):
* Windows 10
* Windows 10 1709
* Windows 10 1809 -> Vagrant Cloud box [StefanScherer/windows_10](https://app.vagrantup.com/StefanScherer/boxes/windows_10)
* Windows 10 Insider
* Windows Server 2016 Desktop
* Windows Server 2019 Desktop (Insider Preview)
* Windows Server 2016 Desktop -> Vagrant Cloud box [StefanScherer/windows_2016](https://app.vagrantup.com/StefanScherer/boxes/windows_2016)
* Windows Server 2019 Desktop -> Vagrant Cloud box [StefanScherer/windows_2019](https://app.vagrantup.com/StefanScherer/boxes/windows_2019)
* Windows Server Core
* Windows Server 2016 without and with Docker
* Windows Server 1709 without and with Docker
* Windows Server 2016 without and with Docker -> Vagrant Cloud box [StefanScherer/windows_2016_docker](https://app.vagrantup.com/StefanScherer/boxes/windows_2016_docker)
* Windows Server 2019 without and with Docker -> Vagrant Cloud box [StefanScherer/windows_2019_docker](https://app.vagrantup.com/StefanScherer/boxes/windows_2019_docker)
* Windows Server 1709, 1803, 1809, 1903, and 1909 all without and with Docker
* Windows Server InsiderPreview Semi-Annual without and with Docker
* Windows Server 2019 Core(Insider Preview)
You may find other packer template files, but older versions of Windows doesn't
work so nice with a Retina display.
......@@ -134,6 +133,25 @@ uncommenting the `WITHOUT WINDOWS UPDATES` section in `Autounattend.xml`:
Doing so will give you hours back in your day, which is a good thing.
### Windows 7 support
Windows 7 is going out of support in January 2020, and the scripts for building Windows 7 machines are only
sporadically maintained.
Windows 7 was first released in 2009. This means there are a lot of updates available for Windows 7,
and running Windows Updates on a Windows 7 box using the mechanism described above takes an extremely long time.
The Windows 7 templates therefore take a slightly different approach, first installing Service Pack 1,
updating the servicing stack and then installing the latest update rollup, .NET 4.8 and PowerShell 5.1.
Finally, any missing updates are installed using Ansible.
This means you'll need to install Ansible on your machine if you want to run the Windows 7 scripts.
You can [install ansible on a Linux machine](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html).
If you want to run these scripts on a Windows machine, you can try to run Ansible in cygwin or Bash on Ubuntu on Windows.
Alternatively, you can disable the `ansible` steps in the `windows_7.json` file. Make sure to manually run
Windows Update if you do!
### WinRM
These boxes use WinRM. There is no OpenSSH installed.
......@@ -148,7 +166,7 @@ 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.
Where `Ethernet` is the name of my default Hyper-V Virtual Switch. You then can use this box with Vagrant to spin up a Hyper-V VM.
#### Generation 2 VMs
......@@ -168,10 +186,44 @@ hyperv-iso output will be in this color.
* Secondary Dvd image does not exist: CreateFile ./iso/windows_server_insider_unattend.iso: The system cannot find the file specified.
```
### KVM/qemu support
If you are using Linux and have KVM/qemu configured, you can use these packerfiles to build a KVM virtual machine.
To build a KVM/qemu box, first make sure:
* You are a member of the kvm group on your machine. You can list the groups you are member of by running `groups`. It should
include the `kvm` group. If you're not a member, run `sudo usermod -aG kvm $(whoami)` to add yourself.
* You have downloaded [the iso image with the Windows drivers for paravirtualized KVM/qemu hardware](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso).
You can do this from the command line: `wget -nv -nc https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso -O virtio-win.iso`.
You can use the following sample command to build a KVM/qemu box:
```
packer build --only=qemu --var virtio_win_iso=./virtio-win.iso ./windows_2019_docker.json
```
### Parallels support
In case you're using Parallels, you can now build the `Windows Server 2019 with Docker` VM.
Prerequisites:
* Parallels Pro or Business, version 11 and up.
* Vagrant Parallels Provider: https://github.com/Parallels/vagrant-parallels
You can use the following sample command to build a Parallels VM:
```
packer build --only=parallels-iso windows_2019_docker.json
```
The Parallels builder config turns `efi boot` off in order to use the same answer file like all the other builders. If you find you need to turn `efi boot` on then make sure to adjust the appropriate answer file, especially the section regarding the partitioning of the disk.
If you need to further customize the VM, consult the documentation at https://www.packer.io/docs/builders/parallels-iso.html.
### Using .box Files With Vagrant
The generated box files include a Vagrantfile template that is suitable for use
with Vagrant 1.7.4+, but the latest ersion is always recommended.
with Vagrant 1.7.4+, but the latest version is always recommended.
Example Steps for Hyper-V:
......@@ -183,4 +235,4 @@ vagrant up --provider hyperv
### Contributing
Pull requests welcomed, but normally should go to Joe's repo.
Pull request are welcome!
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.connection.ssh import Connection as SSHConnection
DOCUMENTATION = '''
connection: packer
short_description: ssh based connections for powershell via packer
description:
- This connection plugin allows ansible to communicate to the target packer machines via ssh based connections for powershell.
author: Packer Community
version_added: na
options:
host:
description: Hostname/ip to connect to.
default: inventory_hostname
vars:
- name: ansible_host
- name: ansible_ssh_host
host_key_checking:
description: Determines if ssh should check host keys
type: boolean
ini:
- section: defaults
key: 'host_key_checking'
- section: ssh_connection
key: 'host_key_checking'
version_added: '2.5'
env:
- name: ANSIBLE_HOST_KEY_CHECKING
- name: ANSIBLE_SSH_HOST_KEY_CHECKING
version_added: '2.5'
vars:
- name: ansible_host_key_checking
version_added: '2.5'
- name: ansible_ssh_host_key_checking
version_added: '2.5'
password:
description: Authentication password for the C(remote_user). Can be supplied as CLI option.
vars:
- name: ansible_password
- name: ansible_ssh_pass
ssh_args:
description: Arguments to pass to all ssh cli tools
default: '-C -o ControlMaster=auto -o ControlPersist=60s'
ini:
- section: 'ssh_connection'
key: 'ssh_args'
env:
- name: ANSIBLE_SSH_ARGS
ssh_common_args:
description: Common extra args for all ssh CLI tools
vars:
- name: ansible_ssh_common_args
ssh_executable:
default: ssh
description:
- This defines the location of the ssh binary. It defaults to ``ssh`` which will use the first ssh binary available in $PATH.
- This option is usually not required, it might be useful when access to system ssh is restricted,
or when using ssh wrappers to connect to remote hosts.
env: [{name: ANSIBLE_SSH_EXECUTABLE}]
ini:
- {key: ssh_executable, section: ssh_connection}
#const: ANSIBLE_SSH_EXECUTABLE
version_added: "2.2"
sftp_executable:
default: sftp
description:
- This defines the location of the sftp binary. It defaults to ``sftp`` which will use the first binary available in $PATH.
env: [{name: ANSIBLE_SFTP_EXECUTABLE}]
ini:
- {key: sftp_executable, section: ssh_connection}
version_added: "2.6"
scp_executable:
default: scp
description:
- This defines the location of the scp binary. It defaults to `scp` which will use the first binary available in $PATH.
env: [{name: ANSIBLE_SCP_EXECUTABLE}]
ini:
- {key: scp_executable, section: ssh_connection}
version_added: "2.6"
scp_extra_args:
description: Extra exclusive to the ``scp`` CLI
vars:
- name: ansible_scp_extra_args
sftp_extra_args:
description: Extra exclusive to the ``sftp`` CLI
vars:
- name: ansible_sftp_extra_args
ssh_extra_args:
description: Extra exclusive to the 'ssh' CLI
vars:
- name: ansible_ssh_extra_args
retries:
# constant: ANSIBLE_SSH_RETRIES
description: Number of attempts to connect.
default: 3
type: integer
env:
- name: ANSIBLE_SSH_RETRIES
ini:
- section: connection
key: retries
- section: ssh_connection
key: retries
port:
description: Remote port to connect to.
type: int
default: 22
ini:
- section: defaults
key: remote_port
env:
- name: ANSIBLE_REMOTE_PORT
vars:
- name: ansible_port
- name: ansible_ssh_port
remote_user:
description:
- User name with which to login to the remote server, normally set by the remote_user keyword.
- If no user is supplied, Ansible will let the ssh client binary choose the user as it normally
ini:
- section: defaults
key: remote_user
env:
- name: ANSIBLE_REMOTE_USER
vars:
- name: ansible_user
- name: ansible_ssh_user
pipelining:
default: ANSIBLE_PIPELINING
description:
- Pipelining reduces the number of SSH operations required to execute a module on the remote server,
by executing many Ansible modules without actual file transfer.
- This can result in a very significant performance improvement when enabled.
- However this conflicts with privilege escalation (become).
For example, when using sudo operations you must first disable 'requiretty' in the sudoers file for the target hosts,
which is why this feature is disabled by default.
env:
- name: ANSIBLE_PIPELINING
#- name: ANSIBLE_SSH_PIPELINING
ini:
- section: defaults
key: pipelining
#- section: ssh_connection
# key: pipelining
type: boolean
vars:
- name: ansible_pipelining
- name: ansible_ssh_pipelining
private_key_file:
description:
- Path to private key file to use for authentication
ini:
- section: defaults
key: private_key_file
env:
- name: ANSIBLE_PRIVATE_KEY_FILE
vars:
- name: ansible_private_key_file
- name: ansible_ssh_private_key_file
control_path:
description:
- This is the location to save ssh's ControlPath sockets, it uses ssh's variable substitution.
- Since 2.3, if null, ansible will generate a unique hash. Use `%(directory)s` to indicate where to use the control dir path setting.
env:
- name: ANSIBLE_SSH_CONTROL_PATH
ini:
- key: control_path
section: ssh_connection
control_path_dir:
default: ~/.ansible/cp
description:
- This sets the directory to use for ssh control path if the control path setting is null.
- Also, provides the `%(directory)s` variable for the control path setting.
env:
- name: ANSIBLE_SSH_CONTROL_PATH_DIR
ini:
- section: ssh_connection
key: control_path_dir
sftp_batch_mode:
default: 'yes'
description: 'TODO: write it'
env: [{name: ANSIBLE_SFTP_BATCH_MODE}]
ini:
- {key: sftp_batch_mode, section: ssh_connection}
type: bool
scp_if_ssh:
default: smart
description:
- "Prefered method to use when transfering files over ssh"
- When set to smart, Ansible will try them until one succeeds or they all fail
- If set to True, it will force 'scp', if False it will use 'sftp'
env: [{name: ANSIBLE_SCP_IF_SSH}]
ini:
- {key: scp_if_ssh, section: ssh_connection}
use_tty:
version_added: '2.5'
default: 'yes'
description: add -tt to ssh commands to force tty allocation
env: [{name: ANSIBLE_SSH_USETTY}]
ini:
- {key: usetty, section: ssh_connection}
type: bool
yaml: {key: connection.usetty}
'''
class Connection(SSHConnection):
''' ssh based connections for powershell via packer'''
transport = 'packer'
has_pipelining = True
become_methods = []
allow_executable = False
module_implementation_preferences = ('.ps1', '')
def __init__(self, *args, **kwargs):
super(Connection, self).__init__(*args, **kwargs)
\ No newline at end of file
- hosts: all
tasks:
- name: Install only security updates
win_updates:
category_names:
- SecurityUpdates
- CriticalUpdates
- UpdateRollups
use_scheduled_task: yes
\ No newline at end of file
- hosts: all
tasks:
- name: Install only security updates
win_updates:
category_names:
- SecurityUpdates
use_scheduled_task: yes
\ No newline at end of file
......@@ -2,6 +2,60 @@
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<servicing/>
<settings pass="windowsPE">
<component name="Microsoft-Windows-PnpCustomizationsWinPE"
publicKeyToken="31bf3856ad364e35" language="neutral"
versionScope="nonSxS" processorArchitecture="amd64"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<!--
This makes the VirtIO drivers available to Windows, assuming that
the VirtIO driver disk at https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso
(see https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html#virtio-win-direct-downloads)
is available as drive E:
-->
<DriverPaths>
<PathAndCredentials wcm:action="add" wcm:keyValue="2">
<Path>E:\viostor\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="3">
<Path>E:\NetKVM\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="4">
<Path>E:\Balloon\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="5">
<Path>E:\pvpanic\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="6">
<Path>E:\qemupciserial\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="7">
<Path>E:\qxldod\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="8">
<Path>E:\vioinput\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="9">
<Path>E:\viorng\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="10">
<Path>E:\vioscsi\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="11">
<Path>E:\vioserial\w10\amd64</Path>
</PathAndCredentials>
</DriverPaths>
</component>
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<DiskConfiguration>
<Disk wcm:action="add">
......
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2012 R2 SERVERSTANDARD</Value>
</MetaData>
</InstallFrom>
......
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2012 R2 SERVERSTANDARDCORE</Value>
</MetaData>
</InstallFrom>
......
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2012 R2 SERVERHYPERCORE</Value>
</MetaData>
</InstallFrom>
......
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2016 SERVERSTANDARD</Value>
</MetaData>
</InstallFrom>
......
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2016 SERVERSTANDARDCORE</Value>
</MetaData>
</InstallFrom>
......
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-PnpCustomizationsWinPE"
publicKeyToken="31bf3856ad364e35" language="neutral"
versionScope="nonSxS" processorArchitecture="amd64"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<!--
This makes the VirtIO drivers available to Windows, assuming that
the VirtIO driver disk at https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso
(see https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html#virtio-win-direct-downloads)
is available as drive E:
-->
<DriverPaths>
<PathAndCredentials wcm:action="add" wcm:keyValue="2">
<Path>E:\viostor\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="3">
<Path>E:\NetKVM\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="4">
<Path>E:\Balloon\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="5">
<Path>E:\pvpanic\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="6">
<Path>E:\qemupciserial\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="7">
<Path>E:\qxldod\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="8">
<Path>E:\vioinput\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="9">
<Path>E:\viorng\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="10">
<Path>E:\vioscsi\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="11">
<Path>E:\vioserial\2k19\amd64</Path>
</PathAndCredentials>
</DriverPaths>
</component>
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
......@@ -50,8 +104,8 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Value>Windows Server 2016 SERVERDATACENTER</Value>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2019 SERVERDATACENTER</Value>
</MetaData>
</InstallFrom>
<InstallTo>
......@@ -65,7 +119,7 @@
<ProductKey>
<!-- Do not uncomment the Key element if you are using trial ISOs -->
<!-- You must uncomment the Key element (and optionally insert your own key) if you are using retail or volume license ISOs -->
<Key>6XBNX-4JQGW-QX6QG-74P76-72V67</Key>
<!-- <Key>6XBNX-4JQGW-QX6QG-74P76-72V67</Key> -->
<WillShowUI>OnError</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
......
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-PnpCustomizationsWinPE"
publicKeyToken="31bf3856ad364e35" language="neutral"
versionScope="nonSxS" processorArchitecture="amd64"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<!--
This makes the VirtIO drivers available to Windows, assuming that
the VirtIO driver disk at https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso
(see https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html#virtio-win-direct-downloads)
is available as drive E:
-->
<DriverPaths>
<PathAndCredentials wcm:action="add" wcm:keyValue="2">
<Path>E:\viostor\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="3">
<Path>E:\NetKVM\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="4">
<Path>E:\Balloon\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="5">
<Path>E:\pvpanic\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="6">
<Path>E:\qemupciserial\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="7">
<Path>E:\qxldod\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="8">
<Path>E:\vioinput\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="9">
<Path>E:\viorng\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="10">
<Path>E:\vioscsi\2k19\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="11">
<Path>E:\vioserial\2k19\amd64</Path>
</PathAndCredentials>
</DriverPaths>
</component>
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
......@@ -51,7 +105,7 @@
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2016 SERVERDATACENTERCORE</Value>
<Value>Windows Server 2019 SERVERDATACENTERCORE</Value>
</MetaData>
</InstallFrom>
<InstallTo>
......@@ -66,7 +120,7 @@
Windows Server Insider product key
See https://blogs.windows.com/windowsexperience/2017/07/13/announcing-windows-server-insider-preview-build-16237/
-->
<Key>B69WH-PRNHK-BXVK3-P9XF7-XD84W</Key>
<!--<Key></Key>-->
<WillShowUI>OnError</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
......@@ -163,14 +217,15 @@
<Description>Disable password expiration for vagrant user</Description>
</SynchronousCommand>
<!-- WITHOUT WINDOWS UPDATES -->
<!--
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\enable-winrm.ps1</CommandLine>
<Description>Enable WinRM</Description>
<Order>99</Order>
</SynchronousCommand>
-->
<!-- END WITHOUT WINDOWS UPDATES -->
<!-- WITH WINDOWS UPDATES -->
<!--
<SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c a:\microsoft-updates.bat</CommandLine>
<Order>98</Order>
......@@ -188,7 +243,6 @@
<Order>100</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
-->
<!-- END WITH WINDOWS UPDATES -->
</FirstLogonCommands>
<OOBE>
......
This diff is collapsed.
This diff is collapsed.
......@@ -50,7 +50,7 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2016 SERVERDATACENTERACORE</Value>
</MetaData>
</InstallFrom>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -50,8 +50,8 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME</Key>
<Value>Windows Server 2016 SERVERDATACENTERACORE</Value>
<Key>/IMAGE/INDEX</Key>
<Value>0</Value>
</MetaData>
</InstallFrom>
<InstallTo>
......
#!/bin/bash
#packer build --only=vmware-iso windows_10.json
#packer build --only=vmware-iso windows_10.json
packer build --only=vmware-iso --var iso_url=~/Downloads/17763.1.180914-1434.rs5_release_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso windows_10.json
# Windows 10 Pro own license
#packer build --only=vmware-iso --var iso_url=~/packer_cache/my/Win10_1607_English_x64.iso --var iso_checksum=99fd8082a609997ae97a514dca22becf20420891 --var autounattend=./tmp/10_pro/Autounattend.xml windows_10.json
# Windows 10 Insider
# packer build --only=vmware-iso --var iso_url=~/packer_cache/connect/16281.1000.170829-1438.rs3_release_CLIENT_BUSINESS_x64FRE_en-us.iso --var iso_checksum=1424eee844683d5e0206f94a034f3ddb80f13f65add5bf838c8608f247a99bd9 windows_10_insider.json
# packer build --only=vmware-iso --var iso_url=~/packer_cache/connect/17025.1000.171020-1626.rs_prerelease_CLIENT_BUSINESS_VOL_x64FRE_en-us.iso --var iso_checksum=2ffc9daea950a2d43e0cafe4807870ce412cf1a9d24a94f6cf9240c71b4b8039 windows_10_insider.json
# Windows 10 Enterprise MSDN
#packer build --only=vmware-iso --var iso_url=~/packer_cache/msdn/en_windows_10_enterprise_version_1607_updated_jan_2017_x64_dvd_9714415.iso --var iso_checksum=97164DD5C1C933BAEF89A4BDE93D544256134FE4 --var iso_checksum_type=sha1 --var autounattend=./tmp/10/Autounattend.xml windows_10.json
# packer build --only=vmware-iso --var iso_url=~/packer_cache/msdn/en_windows_10_enterprise_version_1703_updated_march_2017_x64_dvd_10189290.iso --var iso_checksum=77D5E7C91B5DBBEE410FB6C57CB944238BF7176A --var iso_checksum_type=sha1 --var autounattend=./tmp/10/Autounattend.xml windows_10.json
# Windows 10 Client 15031
#packer build --only=vmware-iso \
# --var iso_url=~/connect/2017-02-08-windows10-15031-rs2/15031.0.170204-1546.RS2_RELEASE_CLIENTPRO-CORE_OEMRET_X64FRE_EN-US.ISO \
# --var iso_checksum=d35a1bc67c4cf0226a4e7381752e81a0ab081356 \
# --var autounattend=./tmp/10_pro_msdn/Autounattend.xml \
# windows_10.json
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/connect/17046.1000.171118-1403.rs_prerelease_CLIENT_BUSINESS_VOL_x64FRE_en-us.iso \
--var iso_checksum=0c014fda2648f3659682e51ef3609f7b127be09db51c59ad632a6c407afba4b6 \
windows_10_insider.json
# --var disk_type_id=3 \
# --var disk_size=30720 \
#!/bin/bash
packer build --only=vmware-iso --var iso_url=~/packer_cache/insider/Windows10_InsiderPreview_EnterpriseVL_x64_en-us_19035.iso windows_10_insider.json
# packer build --only=vmware-iso \
# --var iso_url=~/packer_cache/insider/uupdump_19041.1_PROFESSIONAL_X64_EN-US.iso \
# --var iso_checksum=bcf500c09e2048c8bd2b710ba2b75bed9fe6ef07ea2a584599af81b4b8baa5ed \
# --var autounattend=tmp/10_pro/Autounattend.xml \
# windows_10_insider.json
......@@ -3,5 +3,5 @@
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/insider/Windows_InsiderPreview_Server_vNext_en-us_17639.iso \
--var iso_url=~/downloads/17763.379.190312-0539.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso \
windows_2019.json
if (Test-Path ./output-hyperv-iso) {
Remove-Item -Recurse -Force ./output-hyperv-iso
}
packer build --only=hyperv-iso `
--var iso_url=./iso/17763.379.190312-0539.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso `
--var iso_checksum="221F9ACBC727297A56674A0F1722B8AC7B6E840B4E1FFBDD538A9ED0DA823562" `
windows_2019_docker.json
#!/bin/bash
# Insider ISO
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var autounattend=./tmp/2019_core/Autounattend.xml \
--var iso_url=~/packer_cache/msdn/en_windows_server_2019_x64_dvd_4cb967d8.iso \
--var iso_checksum="4C5DD63EFEE50117986A2E38D4B3A3FBAF3C1C15E2E7EA1D23EF9D8AF148DD2D" \
windows_2019_docker.json
./make_unattend_iso.ps1
if (Test-Path ./output-hyperv-iso) {
Remove-Item -Recurse -Force ./output-hyperv-iso
}
packer build --only=hyperv-iso --var iso_url=./local.iso windows_2019_docker_azure.json
#!/bin/bash
# MSDN 1803 ISO
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/msdn/en_windows_server_version_1803_x64_dvd_12063476.iso \
--var autounattend=./tmp/1803/Autounattend.xml \
windows_server_1803_docker.json
#!/bin/bash
# MSDN 1809 ISO
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/msdn/en_windows_server_version_1809_x64_dvd_92d11ba1.iso \
--var autounattend=./tmp/1809/Autounattend.xml \
windows_server_1809_docker.json
#!/bin/bash
# MSDN 1903 ISO
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/msdn/en_windows_server_version_1903_updated_nov_2019_x64_dvd_78832616.iso \
--var autounattend=./tmp/1903/Autounattend.xml \
windows_server_1903_docker.json
#!/bin/bash
# MSDN 1909 ISO
packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/msdn/en_windows_server_version_1909_x64_dvd_894c6446.iso \
windows_server_1909_docker.json
# --var autounattend=./tmp/1909/Autounattend.xml \
......@@ -4,5 +4,5 @@
PACKER_LOG=debug packer build \
--only=vmware-iso \
--var vhv_enable=true \
--var iso_url=~/packer_cache/insider/Windows_InsiderPreview_Server_17623.iso \
--var iso_url=~/packer_cache/insider/Windows_InsiderPreview_Server_en-us_19035.iso \
windows_server_insider_docker.json
This diff is collapsed.
if not exist "C:\Windows\Temp\chef.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.getchef.com/chef/install.msi', 'C:\Windows\Temp\chef.msi')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://www.getchef.com/chef/install.msi', 'C:\Windows\Temp\chef.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\chef.msi
powershell -Command "Start-Sleep 1" <NUL
\ No newline at end of file
powershell -Command "Start-Sleep 1" <NUL
powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" <NUL
powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
\ No newline at end of file
:: Ensure C:\Chocolatey\bin is on the path
set /p PATH=<C:\Windows\Temp\PATH
set /p PATH=%PATH%;C:\ProgramData\chocolatey\
echo %PATH%
:: Install all the things; for example:
cmd /c choco install 7zip
cmd /c choco install notepadplusplus
\ No newline at end of file
choco install /y 7zip
choco install /y notepadplusplus
choco install /y boxstarter.winconfig
\ No newline at end of file
......@@ -2,13 +2,13 @@ if "%PACKER_BUILDER_TYPE:~0,6%"=="hyperv" (
echo "Skip compact steps in Hyper-V build."
goto :eof
)
if not exist "C:\Windows\Temp\7z920-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
if not exist "C:\Windows\Temp\7z1900-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://www.7-zip.org/a/7z1900-x64.msi', 'C:\Windows\Temp\7z1900-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi
msiexec /qb /i C:\Windows\Temp\7z1900-x64.msi
if not exist "C:\Windows\Temp\ultradefrag.zip" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://downloads.sourceforge.net/project/ultradefrag/stable-release/6.1.0/ultradefrag-portable-6.1.0.bin.amd64.zip', 'C:\Windows\Temp\ultradefrag.zip')" <NUL
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://downloads.sourceforge.net/project/ultradefrag/stable-release/6.1.0/ultradefrag-portable-6.1.0.bin.amd64.zip', 'C:\Windows\Temp\ultradefrag.zip')" <NUL
)
if not exist "C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe" (
......@@ -16,7 +16,7 @@ if not exist "C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe" (
)
if not exist "C:\Windows\Temp\SDelete.zip" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.sysinternals.com/files/SDelete.zip', 'C:\Windows\Temp\SDelete.zip')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://download.sysinternals.com/files/SDelete.zip', 'C:\Windows\Temp\SDelete.zip')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://vagrantboxes.blob.core.windows.net/box/sdelete/v1.6.1/sdelete.exe', 'C:\Windows\Temp\sdelete.exe')" <NUL
)
......@@ -24,7 +24,7 @@ if not exist "C:\Windows\Temp\sdelete.exe" (
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\SDelete.zip -oC:\Windows\Temp"
)
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi
msiexec /qb /x C:\Windows\Temp\7z1900-x64.msi
net stop wuauserv
rmdir /S /Q C:\Windows\SoftwareDistribution\Download
......
......@@ -2,6 +2,7 @@ if ($env:PACKER_BUILDER_TYPE -And $($env:PACKER_BUILDER_TYPE).startsWith("hyperv
Write-Host Skip debloat steps in Hyper-V build.
} else {
Write-Host Downloading debloat zip
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$url="https://github.com/StefanScherer/Debloat-Windows-10/archive/master.zip"
(New-Object System.Net.WebClient).DownloadFile($url, "$env:TEMP\debloat.zip")
Expand-Archive -Path $env:TEMP\debloat.zip -DestinationPath $env:TEMP -Force
......
Write-Output 'Do not open Server Manager at logon'
New-ItemProperty -Path HKCU:\Software\Microsoft\ServerManager -Name DoNotOpenServerManagerAtLogon -PropertyType DWORD -Value "1" -Force
Write-Output 'Install bginfo'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if (!(Test-Path 'c:\Program Files\sysinternals')) {
New-Item -Path 'c:\Program Files\sysinternals' -type directory -Force -ErrorAction SilentlyContinue
}
if (!(Test-Path 'c:\Program Files\sysinternals\bginfo.exe')) {
(New-Object Net.WebClient).DownloadFile('https://live.sysinternals.com/bginfo.exe', 'c:\Program Files\sysinternals\bginfo.exe')
}
if (!(Test-Path 'c:\Program Files\sysinternals\bginfo.bgi')) {
(New-Object Net.WebClient).DownloadFile('https://github.com/StefanScherer/windows-docker-workshop/raw/master/prepare-vms/azure/packer/bginfo.bgi', 'c:\Program Files\sysinternals\bginfo.bgi')
}
if (!(Test-Path 'c:\Program Files\sysinternals\background.jpg')) {
(New-Object Net.WebClient).DownloadFile('https://github.com/StefanScherer/windows-docker-workshop/raw/master/prepare-vms/azure/packer/background.jpg', 'c:\Program Files\sysinternals\background.jpg')
}
$vbsScript = @'
WScript.Sleep 2000
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("""c:\Program Files\sysinternals\bginfo.exe"" /accepteula ""c:\Program Files\sysinternals\bginfo.bgi"" /silent /timer:0")
'@
$vbsScript | Out-File 'c:\Program Files\sysinternals\bginfo.vbs'
Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run -Name bginfo -Value 'wscript "c:\Program Files\sysinternals\bginfo.vbs"'
wscript "c:\Program Files\sysinternals\bginfo.vbs"
Write-Output 'Install Chocolatey'
Invoke-WebRequest 'https://chocolatey.org/install.ps1' -UseBasicParsing | Invoke-Expression
Write-Output 'Install editors'
choco install -y visualstudiocode
Write-Output 'Install Git'
choco install -y git
Write-Output 'Install browsers'
choco install -y googlechrome
choco install -y firefox
Write-Output 'Install Docker Compose'
choco install -y docker-compose
#"Remove" | Out-File C:\Users\vagrant\Desktop\delete-me-to-continue.txt
#while (Test-Path C:\Users\vagrant\Desktop\delete-me-to-continue.txt) {
# Start-Sleep 1
#}
Write-Host "Downloading nanoserver image"
docker import http://172.16.236.1:8080/CBaseOs_rs_prerelease_17035.1000.171103-1616_amd64fre_NanoServer_en-us.tar.gz microsoft/nanoserver-insider:latest
#Write-Host "Downloading windowsservercore image"
#docker import http://172.16.236.1:8080/CBaseOs_rs_prerelease_17035.1000.171103-1616_amd64fre_ServerDatacenterCore_en-us.tar.gz microsoft/windowsservercore-insider:latest
docker images
......@@ -21,9 +21,24 @@ function DockerPull {
$results
}
function DockerRun {
Param ([string]$image)
if ($image -eq "") {
return
}
Write-Host Run first container from $image ...
docker run --rm $image cmd
}
$images | foreach {
DockerPull $_
}
$images | foreach {
DockerPull $_
}
$images | foreach {
DockerRun $_
}
$docker_provider = "ce"
$docker_version = "17.10.0"
# use docker_provider: "ee", "ce", "master" or ""
$docker_provider = "ee"
$docker_version = "18.09.9"
if (Test-Path env:docker_provider) {
$docker_provider = $env:docker_provider
}
......@@ -7,30 +8,42 @@ if (Test-Path env:docker_version) {
$docker_version = $env:docker_version
}
$ProgressPreference = 'SilentlyContinue'
if ($docker_provider -eq "ce") {
$zip_url = $("https://download.docker.com/win/static/edge/x86_64/docker-{0}-ce.zip" -f $docker_version)
} elseif ($docker_provider -eq "ee") {
$folder = $docker_version -replace "\.\d+$", ""
$zip_url = $("https://download.docker.com/components/engine/windows-server/{0}/docker-{1}.zip" -f $folder, $docker_version)
} elseif ($docker_provider -eq "master") {
$docker_version = "master"
$zip_url = "https://master.dockerproject.com/windows/x86_64/docker.zip"
}
if ($zip_url) {
Set-ExecutionPolicy Bypass -scope Process
New-Item -Type Directory -Path "$($env:ProgramFiles)\docker"
Write-Host "Downloading docker $docker_version ..."
wget -outfile $env:TEMP\docker.zip $("https://download.docker.com/win/static/edge/x86_64/docker-{0}-ce.zip" -f $docker_version)
Write-Output "Downloading docker $docker_version ..."
wget -outfile $env:TEMP\docker.zip $zip_url
Expand-Archive -Path $env:TEMP\docker.zip -DestinationPath $env:TEMP -Force
copy $env:TEMP\docker\*.exe $env:ProgramFiles\docker
copy $env:TEMP\docker\*.* $env:ProgramFiles\docker
Remove-Item $env:TEMP\docker.zip
Remove-Item -Recurse $env:TEMP\docker
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$($env:ProgramFiles)\docker", [EnvironmentVariableTarget]::Machine)
$env:Path = $env:Path + ";$($env:ProgramFiles)\docker"
Write-Host "Registering docker service ..."
Write-Output "Registering docker service ..."
. dockerd --register-service
} else {
Write-Host "Install-PackageProvider ..."
Write-Output "Install-PackageProvider ..."
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Write-Host "Install-Module $docker_provider ..."
Install-Module -Name $docker_provider -Force
Write-Host "Install-Package version $docker_version ..."
Write-Output "Install-Module $docker_provider ..."
Install-Module -Name $docker_provider -Repository PSGallery -Force
Write-Output "Install-Package docker version $docker_version ..."
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
$ErrorActionStop = 'SilentlyContinue'
Install-Package -Name docker -ProviderName DockerProvider -RequiredVersion $docker_version -Force
Install-Package -Name docker -ProviderName $docker_provider -RequiredVersion $docker_version -Force
Set-PSRepository -InstallationPolicy Untrusted -Name PSGallery
}
$ErrorActionPreference = 'Stop'
Write-Host "Starting docker ..."
Write-Output "Starting docker ..."
Start-Service docker
rem Enable-NetFirewallRule for WinRM
netsh advfirewall firewall add rule name="Port 5985" dir=in action=allow protocol=TCP localport=5985
sc.exe config winrm start= auto
$NetworkListManager = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
$Connections = $NetworkListManager.GetNetworkConnections()
$Connections | ForEach-Object { $_.GetNetwork().SetCategory(1) }
Enable-PSRemoting -Force
winrm quickconfig -q
winrm quickconfig -transport:http
......
......@@ -3,10 +3,10 @@
:: This fixes a problem with wrong exitcode 0 instead of custom exitcode in PowerShell 2.0
setlocal
if defined ProgramFiles(x86) (
set link=http://hotfixv4.microsoft.com/Windows%%207/Windows%%20Server2008%%20R2%%20SP1/sp2/Fix373932/7600/free/438167_intl_x64_zip.exe
set link=https://hotfixv4.microsoft.com/Windows%%207/Windows%%20Server2008%%20R2%%20SP1/sp2/Fix373932/7600/free/438167_intl_x64_zip.exe
set msufilename=%TEMP%\Windows6.1-KB2552055-x64.msu
) else (
set link=http://hotfixv4.microsoft.com/Windows%%207/Windows%%20Server2008%%20R2%%20SP1/sp2/Fix373932/7600/free/438164_intl_i386_zip.exe
set link=https://hotfixv4.microsoft.com/Windows%%207/Windows%%20Server2008%%20R2%%20SP1/sp2/Fix373932/7600/free/438164_intl_i386_zip.exe
set msufilename=%TEMP%\Windows6.1-KB2552055-x86.msu
)
set zipfilename=%TEMP%\KB2552055.zip
......
powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe', 'C:\Windows\Temp\dotNetFx40.exe')" <NUL
powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object System.Net.WebClient).DownloadFile('https://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe', 'C:\Windows\Temp\dotNetFx40.exe')" <NUL
C:\Windows\Temp\dotNetFx40.exe /q /norestart /repair
......@@ -6,7 +6,7 @@ Write-Output "AutoStart: $AutoStart"
$is_64bit = [IntPtr]::size -eq 8
# setup openssh
$ssh_download_url = "http://www.mls-software.com/files/setupssh-7.1p1-1.exe"
$ssh_download_url = "https://www.mls-software.com/files/setupssh-7.1p1-1.exe"
if (!(Test-Path "C:\Program Files\OpenSSH\bin\ssh.exe")) {
Write-Output "Downloading $ssh_download_url"
......
# https://docs.microsoft.com/de-de/azure/virtual-machines/windows/prepare-for-upload-vhd-image
netsh winhttp reset proxy
"san policy=onlineall" | Out-File -Encoding Ascii $env:TEMP\diskpart.txt
& diskpart /s $env:TEMP\diskpart.txt
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation' -name "RealTimeIsUniversal" 1 -Type DWord
Set-Service -Name w32time -StartupType Automatic
powercfg /setactive SCHEME_MIN
Set-Service -Name bfe -StartupType Automatic
Set-Service -Name dhcp -StartupType Automatic
Set-Service -Name dnscache -StartupType Automatic
Set-Service -Name IKEEXT -StartupType Automatic
Set-Service -Name iphlpsvc -StartupType Automatic
Set-Service -Name netlogon -StartupType Manual
Set-Service -Name netman -StartupType Manual
Set-Service -Name nsi -StartupType Automatic
Set-Service -Name termService -StartupType Manual
Set-Service -Name MpsSvc -StartupType Automatic
Set-Service -Name RemoteRegistry -StartupType Automatic
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -Value 0 -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -name "fDenyTSConnections" -Value 0 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "PortNumber" 3389 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "LanAdapter" 0 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "SecurityLayer" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "fAllowSecProtocolNegotiation" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -name "KeepAliveEnable" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -name "KeepAliveInterval" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "KeepAliveTimeout" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -name "fDisableAutoReconnect" 0 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "fInheritReconnectSame" 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "fReconnectSame" 0 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp' -name "MaxInstanceCount" 4294967295 -Type DWord
Remove-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "SSLCertificateSHA1Hash"
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\DomainProfile' -name "EnableFirewall" -Value 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\PublicProfile' -name "EnableFirewall" -Value 1 -Type DWord
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\Standardprofile' -name "EnableFirewall" -Value 1 -Type DWord
Enable-PSRemoting -force
netsh advfirewall firewall set rule dir=in name="Windows Remote Management (HTTP-In)" new enable=yes
netsh advfirewall firewall set rule dir=in name="Windows Remote Management (HTTP-In)" new enable=yes
netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes
netsh advfirewall firewall set rule dir=in name="File and Printer Sharing (Echo Request - ICMPv4-In)" new enable=yes
bcdedit /set '{bootmgr}' integrityservices enable
bcdedit /set '{default}' device partition=C:
bcdedit /set '{default}' integrityservices enable
bcdedit /set '{default}' recoveryenabled Off
bcdedit /set '{default}' osdevice partition=C:
bcdedit /set '{default}' bootstatuspolicy IgnoreAllFailures
#Enable Serial Console Feature
bcdedit /set '{bootmgr}' displaybootmenu yes
bcdedit /set '{bootmgr}' timeout 10
bcdedit /set '{bootmgr}' bootems yes
bcdedit /ems '{current}' ON
bcdedit /emssettings EMSPORT:1 EMSBAUDRATE:115200
#Setup the Guest OS to collect a kernel dump on an OS crash event
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 2 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f
#Setup the Guest OS to collect user mode dumps on a service crash event
mkdir c:\Crashdumps
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v DumpFolder /t REG_EXPAND_SZ /d "c:\CrashDumps" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v CrashCount /t REG_DWORD /d 10 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v DumpType /t REG_DWORD /d 2 /f
sc config WerSvc start= demand
winmgmt /verifyrepository
if not exist "C:\Windows\Temp\puppet.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://downloads.puppetlabs.com/windows/puppet-3.6.2.msi', 'C:\Windows\Temp\puppet.msi')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://downloads.puppetlabs.com/windows/puppet-3.8.7.msi', 'C:\Windows\Temp\puppet.msi')" <NUL
)
:: http://docs.puppetlabs.com/pe/latest/install_windows.html
......
rem install rsync
if not exist "C:\Windows\Temp\7z920-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
if not exist "C:\Windows\Temp\7z1900-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://www.7-zip.org/a/7z1900-x64.msi', 'C:\Windows\Temp\7z1900-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi
msiexec /qb /i C:\Windows\Temp\7z1900-x64.msi
pushd C:\Windows\Temp
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://mirrors.kernel.org/sourceware/cygwin/x86_64/release/rsync/rsync-3.1.0-1.tar.xz', 'C:\Windows\Temp\rsync-3.1.0-1.tar.xz')" <NUL
cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.0-1.tar.xz"
cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.0-1.tar"
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://mirrors.kernel.org/sourceware/cygwin/x86_64/release/rsync/rsync-3.1.2-1.tar.xz', 'C:\Windows\Temp\rsync-3.1.2-1.tar.xz')" <NUL
cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.2-1.tar.xz"
cmd /c ""C:\Program Files\7-Zip\7z.exe" x rsync-3.1.2-1.tar"
copy /Y usr\bin\rsync.exe "C:\Program Files\OpenSSH\bin\rsync.exe"
rmdir /s /q usr
del rsync-3.1.0-1.tar
del rsync-3.1.2-1.tar
popd
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi
msiexec /qb /x C:\Windows\Temp\7z1900-x64.msi
rem make symlink for c:/vagrant share
mklink /D "C:\Program Files\OpenSSH\vagrant" "C:\vagrant"
net stop tiledatamodelsvc
c:\windows\system32\sysprep\sysprep.exe /generalize /oobe /shutdown /unattend:a:\unattend.xml
if exist a:\unattend.xml (
c:\windows\system32\sysprep\sysprep.exe /generalize /oobe /shutdown /unattend:a:\unattend.xml
) else (
del /F \Windows\System32\Sysprep\unattend.xml
c:\windows\system32\sysprep\sysprep.exe /generalize /oobe /shutdown /quiet
)
if not exist "C:\Windows\Temp\7z920-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
if not exist "C:\Windows\Temp\7z1900-x64.msi" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://www.7-zip.org/a/7z1900-x64.msi', 'C:\Windows\Temp\7z1900-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi
if not exist "C:\Windows\Temp\7z1900-x64.msi" (
powershell -Command "Start-Sleep 5 ; (New-Object System.Net.WebClient).DownloadFile('https://www.7-zip.org/a/7z1900-x64.msi', 'C:\Windows\Temp\7z1900-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z1900-x64.msi
if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
if "%PACKER_BUILDER_TYPE%" equ "qemu" goto :qemu
goto :done
:vmware
......@@ -15,7 +19,7 @@ if exist "C:\Users\vagrant\windows.iso" (
)
if not exist "C:\Windows\Temp\windows.iso" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/14.1.1/7528167/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://softwareupdate.vmware.com/cds/vmw-desktop/ws/15.5.0/14665864/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
rd /S /Q "C:\Program Files (x86)\VMWare"
......@@ -24,8 +28,8 @@ if not exist "C:\Windows\Temp\windows.iso" (
cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"
rd /Q "C:\Windows\Temp\vmware-tools.tar"
rd /Q "C:\Windows\Temp\windows.iso"
del /Q "C:\Windows\Temp\vmware-tools.tar"
del /Q "C:\Windows\Temp\windows.iso"
rd /S /Q "C:\Windows\Temp\VMware"
goto :done
......@@ -36,13 +40,11 @@ if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
)
if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.2.8/VBoxGuestAdditions_5.2.8.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://download.virtualbox.org/virtualbox/6.0.10/VBoxGuestAdditions_6.0.10.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha256-r3.cer
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha256.cer
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha1.cer
cmd /c for %%i in (C:\Windows\Temp\virtualbox\cert\vbox*.cer) do C:\Windows\Temp\virtualbox\cert\VBoxCertUtil add-trusted-publisher %%i --root %%i
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done
......@@ -54,6 +56,12 @@ if exist "C:\Users\vagrant\prl-tools-win.iso" (
cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
rd /S /Q "C:\Windows\Temp\parallels"
)
goto :done
:qemu
if exist "E:\guest-agent\" (
msiexec /qb /x E:\guest-agent\qemu-ga-x86_64.msi
)
:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi
msiexec /qb /x C:\Windows\Temp\7z1900-x64.msi
New-Item -Path "C:\" -Name "Updates" -ItemType Directory