Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ruzickap/865040f76694948d71e0d00a0eecaa88 to your computer and use it in GitHub Desktop.
Save ruzickap/865040f76694948d71e0d00a0eecaa88 to your computer and use it in GitHub Desktop.
Create Packer template and Autounattended file for Windows Server 2016 Eval + download few helper scrips
# Prepare directory structure
mkdir -p /var/tmp/packer_windows-server-2016-eval/{scripts/win-common,http/windows-server-2016,ansible}
cd /var/tmp/packer_windows-server-2016-eval
# Download Autounattended file for Windows Server 2016 Evaluation
wget -c -P http/windows-server-2016 https://raw.githubusercontent.com/ruzickap/packer-templates/master/http/windows-server-2016/Autounattend.xml
# Create some basic Ansible playbook for Windows provisioning
cat > ansible/win.yml << EOF
---
- hosts: all
tasks:
- name: Enable Remote Desktop
win_regedit:
key: 'HKLM:\System\CurrentControlSet\Control\Terminal Server'
value: fDenyTSConnections
data: 0
datatype: dword
- name: Allow connections from computers running any version of Remote Desktop (less secure)
win_regedit:
key: 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp'
value: UserAuthentication
data: 0
datatype: dword
- name: Allow RDP traffic
win_shell: Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
EOF
# Get scripts which helps during Autounattended installation + executed after Ansible
wget -c -P scripts/win-common https://raw.githubusercontent.com/ruzickap/packer-templates/master/scripts/win-common/{fixnetwork.ps1,remove_nic.bat}
# Get the Packer template
wget -c https://raw.githubusercontent.com/ruzickap/packer-templates/master/{windows-server-2016-eval.json,Vagrantfile-windows.template}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment