Powershell - Windows Firewall commands

Here they are some powerhesll commands.

To view actual rule status:

Get-NetFirewallRule -DisplayName '*Remote Desktop*'

To view more detailed rules informations:

Get-NetFirewallRule -DisplayName '*Remote Desktop*' | Get-NetFirewallPortFilter

If you want to setting up to precedent settings displayed:

Get-NetFirewallRule -DisplayName '*Remote Desktop*' | Set-NetFirewallRule -Action Block

Another useful cmdlet is called Show-NetFirewallRule. Recall that we could not see all of the details when using Get-NetFirewallRule earlier. Using Show-NetFirewallRule, we're able to instantly see everything that's involved with one or all firewall rules.


For deeper explanation and relative usage you can review this article: