How to get the local port ??

Welcome Forums General PowerShell Q&A How to get the local port ??

This topic contains 1 reply, has 2 voices, and was last updated by

1 year, 9 months ago.

  • Author
  • #70553

    Points: 0
    Rank: Member

    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 ?


  • #70555

    Points: 24
    Team Member
    Rank: Member

    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

The topic ‘How to get the local port ??’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort