Skip to content

Files

Latest commit

 

History

History
174 lines (130 loc) · 3.75 KB

Windows-Firewall-Management.md

File metadata and controls

174 lines (130 loc) · 3.75 KB

🔥 Windows Firewall Management

🔧 Windows Firewall Service Management

📌 Check Windows Firewall Service Status

  • Retrieves the configuration details of the Windows Firewall service:

    sc qc MpsSvc
  • Checks the current status of the Windows Firewall service:

    sc query MpsSvc

▶️ Start and ⏹️ Stop Windows Firewall Service

  • Stops the Windows Firewall service:

    sc stop MpsSvc
  • Starts the Windows Firewall service:

    sc start MpsSvc

⚙️ Configuring Windows Firewall Using netsh

🛠️ Access Windows Firewall Settings

  • Opens the Windows Firewall settings in the command-line interface:
    netsh advfirewall firewall

❓ Display Help for Firewall Commands

  • Displays the help menu for Windows Firewall advanced settings:

    netsh advfirewall /?
  • Shows available options for displaying firewall settings:

    netsh advfirewall show /?

📜 Display Firewall Profiles

  • Displays the current firewall profile:

    netsh advfirewall show currentprofile
  • Shows the firewall settings for the public profile:

    netsh advfirewall show publicprofile
  • Shows the firewall settings for the private profile:

    netsh advfirewall show privateprofile
  • Displays settings for all firewall profiles:

    netsh advfirewall show allprofiles

🚦 Enable or Disable Windows Firewall

  • Disables the Windows Firewall:

    netsh firewall set opmode disable
  • Enables the Windows Firewall:

    netsh firewall set opmode enable
  • Turns off the firewall for all profiles:

    netsh advfirewall set allprofiles state off
  • Turns on the firewall for all profiles:

    netsh advfirewall set allprofiles state on

🔍 View and Modify Firewall Rules

  • Displays help for firewall rule commands:

    netsh advfirewall firewall /?
  • Dumps the current firewall configuration:

    netsh advfirewall firewall dump
  • Opens TCP port 23 for Telnet Server:

    netsh firewall add portopening tcp 23 "Telnet Server"
  • Displays the current state of the firewall:

    netsh firewall show state
  • Adds a rule to allow inbound FTP client connections:

    netsh advfirewall firewall add rule name="Permit FTP Client" dir=in action=allow enable=yes profile=any program=%SystemRoot%\System32\ftp.exe
  • Displays all configured firewall rules:

    netsh advfirewall firewall show rule
  • Displays details of the "Permit FTP Client" rule:

    netsh advfirewall firewall show rule name="Permit FTP Client"

➕ Adding and ➖ Removing Specific Rules

  • Allows inbound RDP traffic on port 3389:

    netsh advfirewall firewall add rule name="RDP" dir=in action=allow enable=yes profile=any protocol=TCP localport=3389
  • Deletes the "RDP" rule:

    netsh advfirewall firewall delete rule name="RDP" dir=in

✏️ Modifying Firewall Rules

  • Modifies the "HTTP 80" rule to allow traffic on additional ports (80, 81, 82, 83):
    netsh advfirewall firewall set rule name="HTTP 80" new localport=80,81,82,83 action=allow

🖥️ Managing Windows Firewall Using PowerShell

  • Lists all firewall rules:

    get-netfirewallrule -all
  • Lists all firewall rules from the configurable service store:

    get-netfirewallrule -policystore configurableservicestore -all

🛡️ Windows Defender Antivirus Management

📋 Check Windows Defender Status

  • Checks the status of Windows Defender:

    sc query windefend
  • Retrieves the configuration details of Windows Defender:

    sc qc windefend