Firewall Port list through GPO

shai a 1 Reputation point
2022-11-01T18:07:03.307+00:00

Hi
I have a query which returns all enable inbound ports. I would like to make a filter to the current script to check for open ports for certain ports- Some are in ranged port (49152-65535) and some of them are not...

Some questions I have:

  1. How do I make it possible to run on a remote Win10 client inside the Lan (I would like to choose an IP and then it will scan it)
  2. Does this command runs on the GPO FW rules or not?
  3. I want to be able to question a Linux machine with the same script. Can it be accomplished?
  4. How do I show the output on AsBuiltReport framework?

This is the query:

Get-NetFirewallRule -Action Allow -Enabled True -Direction Inbound |
Format-Table -Property Name,
DisplayName,
DisplayGroup,
@{Name='Protocol';Expression={($PSItem | Get-NetFirewallPortFilter).Protocol}},
@{Name='LocalPort';Expression={($PSItem | Get-NetFirewallPortFilter).LocalPort}},
@{Name='RemotePort';Expression={($PSItem | Get-NetFirewallPortFilter).RemotePort}},
@{Name='RemoteAddress';Expression={($PSItem | Get-NetFirewallAddressFilter).RemoteAddress}},
Profile

Thank you in advance.

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.
5,462 questions
0 comments No comments
{count} votes