Windows Firewall CMD: List Rules

Windows Firewall, a crucial component of the Windows operating system, plays a vital role in safeguarding your computer from malicious software and unauthorized network access. While the graphical user interface (GUI) provides an easy way to manage firewall rules, sometimes you might need to delve into the command line for more advanced operations. This article will guide you through listing, understanding, and managing Windows Firewall rules using the command line.

the windows firewall and defender screen
the windows firewall and defender screen

Before we dive into the commands, ensure you have administrative privileges on your Windows machine. Many firewall operations require elevated permissions. Also, it's essential to understand that these commands are case-sensitive and should be executed in the Command Prompt or PowerShell.

30 Hacks You Should Know...
30 Hacks You Should Know...

Listing Windows Firewall Rules

To list all the rules in the Windows Firewall, you can use the following command in the Command Prompt:

the essential guide to windows cmd commands you should know
the essential guide to windows cmd commands you should know

netsh advfirewall firewall show rule name=all

This command will display a list of all rules along with their names, groups, enabled status, and other relevant details. However, the output can be quite extensive, making it difficult to parse through. To make it more manageable, you can redirect the output to a text file:

the firewall screen is showing that it's not working on any network or device
the firewall screen is showing that it's not working on any network or device

netsh advfirewall firewall show rule name=all > firewall_rules.txt

Filtering Rules by Name

If you're looking for a specific rule, you can filter the output by name using the following command:

the user interface for windows run commands is shown in this screenshote, which shows how
the user interface for windows run commands is shown in this screenshote, which shows how

netsh advfirewall firewall show rule name="rule_name"

Replace rule_name with the name of the rule you're looking for. This command will display detailed information about the specified rule.

Filtering Rules by Group

an image of the windows command screen
an image of the windows command screen

You can also filter rules by their group using the following command:

netsh advfirewall firewall show rule group="group_name"

the user's windows run commands are displayed in this screenshote, which is also
the user's windows run commands are displayed in this screenshote, which is also
the firewall menu is highlighted in green and black text, with an arrow pointing to it
the firewall menu is highlighted in green and black text, with an arrow pointing to it
Useful window commands
Useful window commands
Home Network Firewall Rules: Minimal Allow/Block List That Still Works
Home Network Firewall Rules: Minimal Allow/Block List That Still Works
Essential Windows CMD Commands You Should Know
Essential Windows CMD Commands You Should Know
the basic commands for using command commands
the basic commands for using command commands
Find wifi password with Windows CMD
Find wifi password with Windows CMD
104K views ยท 396 reactions | ๐Ÿšจ Fix Windows Network Problems Like a Pro ๐Ÿ’ป๐ŸŒ Slow internet? DNS errors? Wi-Fi disconnecting? ๐Ÿ˜ฉ These powerful Windows CMD commands can help diagnose and fix common network issues qui | Tech Whiz Ajith
104K views ยท 396 reactions | ๐Ÿšจ Fix Windows Network Problems Like a Pro ๐Ÿ’ป๐ŸŒ Slow internet? DNS errors? Wi-Fi disconnecting? ๐Ÿ˜ฉ These powerful Windows CMD commands can help diagnose and fix common network issues qui | Tech Whiz Ajith
Commandes CMD Windows essentielles que vous devez connaรฎtre
Commandes CMD Windows essentielles que vous devez connaรฎtre
15+ Best CMD Tricks And Hacks (Command Prompt) 2025 - [Top List] - Safe Tricks
15+ Best CMD Tricks And Hacks (Command Prompt) 2025 - [Top List] - Safe Tricks
CMD Commands for Windows: 15 Fixes to Solve Most PC Issues Fast
CMD Commands for Windows: 15 Fixes to Solve Most PC Issues Fast
Cyveer - ๐—ช๐—ถ๐—ป๐—ฑ๐—ผ๐˜„๐˜€ ๐—ก๐—ฒ๐˜๐˜„๐—ผ๐—ฟ๐—ธ๐—ถ๐—ป๐—ด ๐—–๐—ผ๐—บ๐—บ๐—ฎ๐—ป๐—ฑ๐˜€ ๐—–๐—ต๐—ฒ๐—ฎ๐˜๐˜€๐—ต๐—ฒ๐—ฒ๐˜  ๐Ÿ‘‰ ๐—™๐—ผ๐—น๐—น๐—ผ๐˜„ Cyveer - Cybersecurity Awareness & Resources for insightful content on ๐Ÿ”Cybersecurity, ๐Ÿ›ก Governance, Risk, Compliance (GRC), ๐Ÿฅท Ethical Hacking, and ๐Ÿš€ Career Development.  #cyveer #cybersecurity #windows #Networking #WindowsCommands #cheatsheet | Facebook
Cyveer - ๐—ช๐—ถ๐—ป๐—ฑ๐—ผ๐˜„๐˜€ ๐—ก๐—ฒ๐˜๐˜„๐—ผ๐—ฟ๐—ธ๐—ถ๐—ป๐—ด ๐—–๐—ผ๐—บ๐—บ๐—ฎ๐—ป๐—ฑ๐˜€ ๐—–๐—ต๐—ฒ๐—ฎ๐˜๐˜€๐—ต๐—ฒ๐—ฒ๐˜ ๐Ÿ‘‰ ๐—™๐—ผ๐—น๐—น๐—ผ๐˜„ Cyveer - Cybersecurity Awareness & Resources for insightful content on ๐Ÿ”Cybersecurity, ๐Ÿ›ก Governance, Risk, Compliance (GRC), ๐Ÿฅท Ethical Hacking, and ๐Ÿš€ Career Development. #cyveer #cybersecurity #windows #Networking #WindowsCommands #cheatsheet | Facebook
Create Windows Firewall Rules with PowerShell
Create Windows Firewall Rules with PowerShell
windows networking commands chart with the names and abbreviations for each network, including different types of
windows networking commands chart with the names and abbreviations for each network, including different types of
the user's windows run commands are displayed in this screenshote screen shot
the user's windows run commands are displayed in this screenshote screen shot
a black background with green and blue text that reads must - know windows commands
a black background with green and blue text that reads must - know windows commands
CMD Commands for Windows: 15 Fixes That Solve 80% of Common PC Problems
CMD Commands for Windows: 15 Fixes That Solve 80% of Common PC Problems
the fortgate firewall commands poster
the fortgate firewall commands poster
a table with several different types of windows and the same number of names on it
a table with several different types of windows and the same number of names on it
the windows incident response list is shown in this screenshote, which shows that there are
the windows incident response list is shown in this screenshote, which shows that there are

Replace group_name with the name of the group you want to filter. This command will list all rules belonging to the specified group.

Understanding Windows Firewall Rule Properties

Each rule in the Windows Firewall has several properties that determine its behavior. You can list these properties using the following command:

netsh advfirewall firewall show rule name="rule_name" all

This command will display all the properties of the specified rule, including its name, group, action, direction, protocol, and local ports.

Enabling and Disabling Rules

To enable or disable a rule, you can use the following commands:

netsh advfirewall firewall set rule name="rule_name" new enable=yes

To disable a rule, replace yes with no:

netsh advfirewall firewall set rule name="rule_name" new enable=no

Deleting Rules

To delete a rule, you can use the following command:

netsh advfirewall firewall delete rule name="rule_name"

Managing Windows Firewall Profiles

Windows Firewall has three profiles: Domain, Private, and Public. Each profile can have its own set of rules. To list all rules for a specific profile, use the following command:

netsh advfirewall firewall show rule profile=profile_name

Replace profile_name with the name of the profile you want to list (Domain, Private, or Public).

Switching Profiles

To switch between profiles, you can use the following command:

netsh advfirewall set currentprofile profile_name

Replace profile_name with the name of the profile you want to switch to.

In conclusion, understanding and managing Windows Firewall rules using the command line can be a powerful tool for system administrators and power users. Whether you're looking to list, enable, disable, or delete rules, the commands outlined in this article provide a comprehensive guide to help you achieve your goals. Always remember to exercise caution when modifying firewall rules to ensure the security of your system.