Here's a PowerShell script to configure the firewall on a Windows Server:
# Disable firewall Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False # Enable firewall Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True # Add firewall rule for incoming HTTP traffic on port 80 New-NetFirewallRule -DisplayName "Allow HTTP Traffic" -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow # Add firewall rule for incoming HTTPS traffic on port 443 New-NetFirewallRule -DisplayName "Allow HTTPS Traffic" -Direction Inbound -Protocol TCP -LocalPort 443 -Action Allow # Add firewall rule for incoming RDP traffic on port 3389 New-NetFirewallRule -DisplayName "Allow RDP Traffic" -Direction Inbound -Protocol TCP -LocalPort 3389 -Action Allow
Note: This script disables the firewall, enables it again and creates rules for incoming HTTP (port 80), HTTPS (port 443), and RDP (port 3389) traffic. You can add or modify rules as per your requirements.
No comments:
Post a Comment