Skip to content

Instantly share code, notes, and snippets.

@brandocorp
Last active August 29, 2015 14:20
Show Gist options
  • Save brandocorp/5534f3a27070e8abcc46 to your computer and use it in GitHub Desktop.
Save brandocorp/5534f3a27070e8abcc46 to your computer and use it in GitHub Desktop.
Prepare server to be bootstrapped by Chef with WinRM
# Get network connections
$networkListManager = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
$connections = $networkListManager.GetNetworkConnections()
$connections | % {$_.GetNetwork().SetCategory(1)}
# run quick config
winrm qc -q
# allow incoming traffic from anywhere (still requires VPN connection)
netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" profile=private new enable=yes remoteip=any localip=any protocol=tcp
# set additional chef-requirements for bootstrap
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"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment