You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
1.3 KiB
24 lines
1.3 KiB
4 years ago
|
Write-Host "Performing the WinRM setup necessary to get the host ready for packer to run Chef..."
|
||
|
|
||
|
# parts of this are from https://github.com/luciusbono/Packer-Windows10/blob/master/configure-winrm.ps1
|
||
|
# and https://github.com/rgl/windows-2016-vagrant/blob/master/winrm.ps1
|
||
|
|
||
|
# Supress network location Prompt
|
||
|
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" -Force
|
||
|
|
||
|
# The above suppresses the prompt but defaults to "Public" which prevents WinRM from being enabled even with the SkipNetworkProfileCheck arg
|
||
|
# This command sets any network connections detected to Private to allow WinRM to be configured and started
|
||
|
Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory "Private"
|
||
|
|
||
|
# Does a lot: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/enable-psremoting?view=powershell-6
|
||
|
Enable-PSRemoting -SkipNetworkProfileCheck -Force
|
||
|
# May not be necessary since we set the profile to Private above
|
||
|
Set-NetFirewallRule -Name "WINRM-HTTP-In-TCP" -RemoteAddress Any # allow winrm over public profile interfaces
|
||
|
|
||
|
winrm set "winrm/config" '@{MaxTimeoutms="1800000"}'
|
||
|
winrm set "winrm/config/winrs" '@{MaxMemoryPerShellMB="2048"}'
|
||
|
winrm set "winrm/config/service" '@{AllowUnencrypted="true"}'
|
||
|
winrm set "winrm/config/service/auth" '@{Basic="true"}'
|
||
|
|
||
|
exit 0
|