Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.