-
-
Save phwelo/b0570e5282adb30e402ad80d0d7e7b97 to your computer and use it in GitHub Desktop.
[Packer WinRM config] Userdata for packer to config winrm in a sane way #Powershell #WinRM #Packer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<powershell> | |
winrm quickconfig -q | |
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}' | |
winrm set winrm/config '@{MaxTimeoutms="1800000"}' | |
winrm set winrm/config/service '@{AllowUnencrypted="true"}' | |
winrm set winrm/config/service/auth '@{Basic="true"}' | |
netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow | |
netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow | |
net stop winrm | |
sc config winrm start=auto | |
net start winrm | |
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope LocalMachine | |
</powershell> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"builders": [{ | |
"type": "amazon-ebs", | |
"region": "us-east-1", | |
"source_ami": "ami-c01102a8", | |
"instance_type": "m3.medium", | |
"ami_name": "windows-ami {{timestamp}}", | |
"user_data_file": "{{template_dir}}/setup_winrm.txt", | |
"communicator": "winrm", | |
"winrm_username": "Administrator" | |
}], | |
"provisioners": [ | |
{ | |
"type": "powershell", | |
"inline": [ | |
"dir c:\\" | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment