Skip to content

Instantly share code, notes, and snippets.

@jimcroft
Last active March 20, 2018 14:21
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save jimcroft/3878113 to your computer and use it in GitHub Desktop.
Save jimcroft/3878113 to your computer and use it in GitHub Desktop.
Enable WinRM for Chef bootstrapping via EC2 user data
<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
</powershell>
@themathmagician
Copy link

Needs to be:
sc config winrm start= auto

@wlscaudill
Copy link

Just what I was looking for, thank you!

@Sauraus
Copy link

Sauraus commented Dec 9, 2017

This can't work in PowerShell (Windows 2016), because sc is an alias for Set-Content, this has to be run in a CMD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment