Skip to content

Instantly share code, notes, and snippets.

@charlesjohnson
Last active March 16, 2016 00:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charlesjohnson/7789658 to your computer and use it in GitHub Desktop.
Save charlesjohnson/7789658 to your computer and use it in GitHub Desktop.
# Note: This can take as long as 15 minutes, and will show the bootstrap stuck at "waiting for winrm," but should not take more than 30.
knife ec2 server create -V -V --flavor m1.large --bootstrap-protocol winrm -I ami-173d747e --user-data ./userdata.ps1 -r "role[nopcommerce]" -x opscode -P "opscode" -N demo_nopcommerce1 --tags "Name=demo_nopcommerce1" -Z us-east-1d --distro "windows-chef-client-msi" -S charles_opscode
<powershell>
#####
#DON'T FORGET TO SET/CHANGE THE USERNAME/PASSWORD BELOW!!!!!!!!!!
#####
$user="NOPE"
$password="NU-UH"
#Disable password complexity requirements
"[System Access]" | out-file c:\delete.cfg
"PasswordComplexity = 0" | out-file c:\delete.cfg -append
"[Version]" | out-file c:\delete.cfg -append
'signature="$CHICAGO$"' | out-file c:\delete.cfg -append
secedit /configure /db C:\Windows\security\new.sdb /cfg c:\delete.cfg /areas SECURITYPOLICY
# Create a user with her password, add to Admin group
net user /add $user $password;
net localgroup Administrators /add $user;
# Get the instance ready for Chef bootstrapper, commands courtesy of Julian Dunn
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 set rule name="Windows Remote Management (HTTP-In)" profile=public protocol=tcp localport=5985 remoteip=localsubnet new remoteip=any
</powershell>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment