Here’s a handy script that automates the setup process:
# 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