Here’s a handy script that automates the setup process:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Run as Administrator # Configure WinRM try { winrm quickconfig -quiet Write-Host "WinRM configured successfully." } catch { Write-Error "An error occurred while configuring WinRM." Exit } # Configure Firewall to Allow WinRM try { New-NetFirewallRule -Name "WinRM HTTP" -DisplayName "WinRM HTTP" -Enabled True -Profile Any -Action Allow -Direction Inbound -LocalPort 5985 -Protocol TCP Write-Host "WinRM Firewall rule added." } catch { Write-Error "An error occurred while configuring the Firewall for WinRM." Exit } |
0 Comments