From 8cf16b5c899a60ea5982c5d8dc042153daf6ac5b Mon Sep 17 00:00:00 2001 From: heqnx Date: Fri, 11 Jul 2025 21:50:55 +0300 Subject: added packer templates --- packer/files/scripts/windows/enable-winrm-http.ps1 | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 packer/files/scripts/windows/enable-winrm-http.ps1 (limited to 'packer/files/scripts/windows/enable-winrm-http.ps1') diff --git a/packer/files/scripts/windows/enable-winrm-http.ps1 b/packer/files/scripts/windows/enable-winrm-http.ps1 new file mode 100644 index 0000000..44d8e70 --- /dev/null +++ b/packer/files/scripts/windows/enable-winrm-http.ps1 @@ -0,0 +1,29 @@ +Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private + +New-ItemProperty ` + -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' ` + -Name LocalAccountTokenFilterPolicy ` + -Value 1 ` + -Force | Out-Null + +winrm quickconfig -q +winrm quickconfig -transport:http +winrm set winrm/config '@{MaxTimeoutms="1800000"}' +winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="800"}' +winrm set winrm/config/service '@{AllowUnencrypted="true"}' +winrm set winrm/config/service/auth '@{Basic="true"}' +winrm set winrm/config/service/auth '@{CredSSP="true"}' +winrm set winrm/config/listener?Address=*+Transport=HTTP '@{Port="5985"}' +Start-Process -FilePath C:\Windows\System32\cmd.exe -ArgumentList "/c sc.exe config WinRM start= delayed-auto" -Wait -Verbose +Start-Process -FilePath C:\Windows\System32\cmd.exe -ArgumentList "/c sc.exe stop WinRM" -Wait -Verbose +Start-Process -FilePath C:\Windows\System32\cmd.exe -ArgumentList "/c sc.exe start WinRM" -Wait -Verbose + +New-NetFirewallRule ` + -DisplayName WINRM-HTTP-In-TCP ` + -Direction Inbound ` + -Action Allow ` + -Protocol TCP ` + -LocalPort 5985 | Out-Null + +#netsh advfirewall firewall set rule group="Windows Remote Administration" new enable=yes +#netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" new enable=yes action=allow remoteip=any -- cgit v1.2.3