Powershell - list Firewall rules

WW 341 Reputation points


I use this powershell commands for listing firewall rules:

Get-NetFirewallRule -Direction Inbound | Select-Object Name, DisplayName, Description

Show-NetFirewallRule | where {$_.enabled -eq true' -AND $_.direction -eq inbound'}| select displayname

With these commands I can't see rules applied through GPO. Does anybody know how can I accomplish this?

Thank you!

Best regards.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
4,630 questions
No comments
{count} votes

2 answers

Sort by: Most helpful
  1. WW 341 Reputation points


    I've managed to get it using this command:

    Get-NetFirewallRule -PolicyStore ActiveStore | Where-Object {$_.Description -eq "My_GPO"}

    As per MS we must user -PolicyStore for GPO applied policies.

    Now, my question is what gives this rule a Name because I can see it is some kind of guid and can I locate this guid Name on a computer (the name my GPO has is under DisplayName:

    No comments

  2. Ian Xue (Shanghai Wicresoft Co., Ltd.) 18,351 Reputation points Microsoft Employee


    The name is a random GUID generated by the NewGuid() method.

    You can use the GUID to locate the firewall rule with the Where-Object cmdlet.

    Best Regards,
    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments