Skip to content

Instantly share code, notes, and snippets.

@juliandunn
Created July 9, 2015 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliandunn/f58e189768006e751d2b to your computer and use it in GitHub Desktop.
Save juliandunn/f58e189768006e751d2b to your computer and use it in GitHub Desktop.
<powershell>
#####
#DON'T FORGET TO SET/CHANGE THE USERNAME/PASSWORD BELOW!
#####
$user="chef"
$password="chef"
# Disable password complexity requirements
$seccfg = [IO.Path]::GetTempFileName()
secedit /export /cfg $seccfg
(Get-Content $seccfg) | Foreach-Object {$_ -replace "PasswordComplexity\s*=\s*1", "PasswordComplexity=0"} | Set-Content $seccfg
secedit /configure /db $env:windir\security\new.sdb /cfg $seccfg /areas SECURITYPOLICY
del $seccfg
# Create a user with her password, add to Admin group
net user /add $user $password;
net localgroup Administrators /add $user;
# These commands are necessary only if the target machine is being
# used as a Chef node and you want to bootstrap it. They do not need
# to appear on a "workstation" machine.
#
# Get the instance ready for Chef bootstrapper
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="512"}'
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