NetSecurity module: setup and commands
Documentation: Microsoft Learn
Inspect Windows Firewall profiles and rules with Get-NetFirewallProfile and Get-NetFirewallRule before changing direction, scope or enforcement.
Getting it
Included with Windows 8 and Windows Server 2012 onward. Windows only.
Examples
Show reference output
Show reference output
What it is for
Use it to prove which profile is active and which rules are enabled on a host under investigation. It is also the supported way to create a rule from automation instead of clicking through the firewall console on each server.
Typical tasks
- Confirm firewall state for each profile
- List enabled inbound rules with their actions
- Trace a rule back to its port filter
- Create a scoped rule for one application
- Find rules that allow any remote address
- Export the rule set for a compliance record
Check the installed version
Compare the module path and version with the session used by your scheduled task or automation account. Use it to prove which profile is active and which rules are enabled on a host under investigation. It is also the supported way to create a rule from automation instead of clicking through the firewall console on each server.