Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- ------------------------------------------------------------------------------------------
- SRC: https://social.technet.microsoft.com/Forums/ie/en-US/3294e7c9-3b2b-408f-bca8-032f2b2fc33e/windows-firewall-rules?forum=winserverpowershell
- O/P: https://imgur.com/as3wwCd
- ------------------------------------------------------------------------------------------
- #>
- #Firewall
- $Firewall = Get-NetFirewallRule
- #Condition
- $Condition = $Firewall | Where-Object {$_.Enabled -eq $true -and $_.Action -eq "Block"}
- #Rule
- $Condition |
- ForEach-Object{
- $Rule = $_
- $_ | Get-NetFirewallPortFilter |
- ForEach-Object{
- [pscustomobject]@{
- FQDN = "$env:computerName.$env:USERDNSDOMAIN"
- DisplayName = $Rule.DisplayName
- Name = $Rule.Name
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement