Author Posts

May 12, 2017 at 3:43 am

I'm trying to get a full report that contains

DisplayName, Description, Enabled, Profile, Direction, Action, PrimaryStatus, Status + Local Port

But when I run " Get-NetFirewallPortFilter -Protocol UDP | Get-NetFirewallRule " Doesn't show the local port #

How to add the local port ?

Thanks

May 12, 2017 at 8:25 am

Hi, the following is a working example:

Get-NetFirewallPortFilter -Protocol UDP | ForEach-Object {
    $rule = Get-NetFirewallRule -AssociatedNetFirewallPortFilter $PSItem

    [PSCustomObject] @{
        Name = $rule.Name
        DisplayName = $rule.DisplayName
        LocalPort = $PSItem.LocalPort
    }
} | Sort-Object -Property Name

– Daniel