Skip to content

Instantly share code, notes, and snippets.

@mpoore
Created April 28, 2020 15:20
Show Gist options
  • Save mpoore/c9606ebf591f04c064ac13c2c9243e54 to your computer and use it in GitHub Desktop.
Save mpoore/c9606ebf591f04c064ac13c2c9243e54 to your computer and use it in GitHub Desktop.
Phase 1 configuration script for Windows 2019 deployment using Packer
# Basic configuration of vanilla Windows Server installation to progress Packer.io builds
# @author Michael Poore
# @website https://blog.v12n.io
# @source https://github.com/virtualhobbit
$ErrorActionPreference = "Stop"
# Switch network connection to private mode
# Required for WinRM firewall rules
$profile = Get-NetConnectionProfile
Set-NetConnectionProfile -Name $profile.Name -NetworkCategory Private
# Enable WinRM service
winrm quickconfig -quiet
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
# Reset auto logon count
# https://docs.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-autologon-logoncount#logoncount-known-issue
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name AutoLogonCount -Value 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment