Example from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.
netsh advfirewall firewall add rule name="AllowHTTPS" protocol=TCP dir=in localport=443 action=allowConfigures and manages Windows Firewall with Advanced Security, including profiles, rules, logging, connection security and monitoring. This guide lists the documented syntax and parameters for netsh advfirewall; check Microsoft Learn for version, role and execution-context requirements.
netsh advfirewall consec | dump | export | firewall | help | import | mainmode | monitor | reset | set | show | ?
netsh advfirewall [consec | firewall | mainmode] <add> <delete> <dump> <help> <set> <show> <?>
netsh advfirewall [monitor] <delete> <dump> <help> <show> <?>
netsh advfirewall export <path\filename>
netsh advfirewall import <path\filename>
netsh advfirewall reset [export <path\filename>]
netsh advfirewall set [allprofiles | currentprofile | domainprofile | privateprofile | publicprofile] state <on> <off> <notconfigured>
netsh advfirewall set firewallpolicy <blockinbound> <blockinboundalways> <allowinbound> <allowoutbound> <blockoutbound> <notconfigured>
netsh advfirewall set settings <localfirewallrules> <localconsecrules> <inboundusernotification> <remotemanagement> <unicastresponsetomulticast>
netsh advfirewall set logging <allowedconnections> <droppedconnections> <filename> <maxfilesize>
netsh advfirewall set global [statefulftp | statefulpptp] <enable> <disable> <notconfigured>
netsh advfirewall set global ipsec [strongcrlcheck <value>] [saidletimemin <value>] [defaultexemptions <value>] [ipsecthroughnat <value>] [authzcomputergrp <value>] [authzusergrp <value>]
netsh advfirewall set global mainmode [mmkeylifetime <value>] [mmsecmethods <value>] [mmforcedh <value>]
netsh advfirewall show [allprofiles | currentprofile | domainprofile | privateprofile | publicprofile] <state> <firewallpolicy> <settings> <logging>
netsh advfirewall show global <ipsec> <statefulftp> <statefulpptp> <mainmode> <categories>
netsh advfirewall show <store>The linked Microsoft Learn article is the upstream authority. Availability may depend on Windows release, role, optional feature or interactive tool context.
Example from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.
netsh advfirewall firewall add rule name="AllowHTTPS" protocol=TCP dir=in localport=443 action=allowExample from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.
netsh advfirewall export C:\Backup\firewall.wfwExample from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.
netsh advfirewall show allprofiles| Option / clause | Description |
|---|---|
consec / firewall / mainmode | Enter the connection-security, firewall-rule or main-mode context. |
monitor | Inspect runtime firewall and security-association state. |
dump | Display a script representing the current configuration. |
export <path\filename> | Export firewall policy to a backup file. |
import <path\filename> | Import policy from a file into the current policy store. |
reset [export <path\filename>] | Restore default firewall policy; optionally export the current policy first. |
set <profile> state <on|off|notconfigured> | Configure firewall state for one or more profiles; disabling the firewall removes filtering protection. |
set firewallpolicy <policy> | Set default inbound and outbound traffic behavior. |
set settings / set logging | Configure local rules, notifications, remote management and log options. |
set global ipsec / mainmode | Configure global IPsec and main-mode policy values; legacy algorithms may be insecure. |
show <profile|parameter> | Display profile or global firewall settings. |
add / delete / set rule | Manage inbound/outbound firewall rules or connection-security rules; validate scope before applying changes. |
help / ? | List commands available in the current context. |
? | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
allprofiles | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
currentprofile | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
domainprofile | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
privateprofile | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
publicprofile | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<add> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<delete> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<dump> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<help> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<set> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<show> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<on> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<off> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<notconfigured> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<blockinbound> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<blockinboundalways> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<allowinbound> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<allowoutbound> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<blockoutbound> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<localfirewallrules> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<localconsecrules> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<inboundusernotification> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<remotemanagement> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<unicastresponsetomulticast> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<allowedconnections> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<droppedconnections> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<filename> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<maxfilesize> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<enable> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<disable> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<value> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<state> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<firewallpolicy> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<settings> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<logging> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<ipsec> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<statefulftp> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<statefulpptp> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<mainmode> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<categories> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
<store> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.