How to get the local port ??

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

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