Manage Windows Firewall with PowerShell
Refer to NetSecurity Module for functionality provided on how to Manage Windows Firewall with PowerShell
Firewall Profile
Windows Firewall Profile is enabled by default on Domain, Private and Public with
- Outbound Connection = Allow (Default)
- Inbound Connection = Block (Default) with some of the core networking features allowed, like DHCP
Get-NetFirewallProfile | Select Name, Enabled
Third-party applications will automatically add Additional Rules, like AnyDesk during installation to allow it to function even with Windows Firewall enabled
Get-NetFirewallRule | ? DisplayName -like "AnyDesk" | Select DisplayName, Profile, Enabled
DisplayName Profile Enabled
----------- ------- -------
AnyDesk Private True
AnyDesk Private True
AnyDesk Domain True
AnyDesk Domain True
Windows Firewall Profile is applied based on the Network Connection Profile in Network and Sharing Center

# List the Active Network Connection Profile
Get-NetConnectionProfile
# List the Active Windows Firewall Profile
netsh advfirewall show currentprofile
Enable / Disable Firewall Profile
#Enable Firewall for all profile
Set-NetFirewallProfile -Profile Domain,Private, Public -Enabled true
#Disable Firewall for all profile
Set-NetFirewallProfile -Profile Domain,Private, Public -Enabled false
Predefined Firewall Rules / Groups
Several predefined Firewall Rule is provided by default
