If a Microsoft Windows system is running the
Microsoft Defender
Firewall,
firewall software that comes with Microsoft Windows systems, you can
check on whether connectivity is allowed on a particular
network
port from a
command-line
interface (CLI) using
PowerShell. You can determine whether the Windows Firewall is active on a
system from a command prompt
using the command netsh advfirewall show
currentprofile
. If the value of "State" is "ON", then the Windows
Firewall is active on the system.
C:\>netsh advfirewall show currentprofile Domain Profile Settings: ---------------------------------------------------------------------- State ON Firewall Policy BlockInbound,AllowOutbound LocalFirewallRules N/A (GPO-store only) LocalConSecRules N/A (GPO-store only) InboundUserNotification Enable RemoteManagement Disable UnicastResponseToMulticast Enable Logging: LogAllowedConnections Disable LogDroppedConnections Disable FileName %systemroot%\system32\LogFiles\Firewall\pfirewall.log MaxFileSize 4096 Ok. C:\>
You can check on whether the firewall is permitting connectivity on a
particular network port, e.g., TCP port 3389 for the
Remote Desktop
Protocol (RDP), from a PowerShell prompt, which you can obtain by
typing powershell
in the Windows "Search" field at the bottom
of the screen and then clicking on Windows PowerShell when you see
it returned by the search function. At the PowerShell prompt, you can issue
the command Get-NetFirewallPortFilter | Where-Object { $_.LocalPort -eq
3389 } | Get-NetFirewallRule
. If you wished to check on whether
firewall connectivity is permitted for some other protocol, substitute
the port used by that protocol, e.g., port 22 for
Secure Shell (SSH)
connections.
[ More Info ]