Created
March 12, 2020 20:53
-
-
Save chadmando/e91ccc9d39bb32b16eb377c0449e719f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# modified from this blog post https://itluke.online/2018/11/27/how-to-display-firewall-rule-ports-with-powershell/ | |
# Looks for Enabled, Inbound Rules that start with the letter "Q" | |
Get-netfirewallrule | | |
Where-Object {$_.Enabled -eq $True -and $_.DisplayName -like "Q*" -and $_.Direction -eq "Inbound"} | | |
Select-Object -Property Name, | |
DisplayName, | |
@{Name='Protocol';Expression={($_ | Get-NetFirewallPortFilter).Protocol}}, | |
@{Name='LocalPort';Expression={($_ | Get-NetFirewallPortFilter).Localport}}, | |
@{Name='RemotePort';Expression={($_ | Get-NetFirewallPortFilter).RemotePort}}, | |
@{Name='RemoteAddress';Expression={($_ | Get-NetFirewallPortFilter).RemoteAddress}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment