Created
February 22, 2023 12:49
-
-
Save alimbada/cb3dd5963f31347a51e3483a7fb7df2c to your computer and use it in GitHub Desktop.
Use PowerShell to get Windows firewall rules for applications that are no longer installed.
This file contains hidden or 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
Get-NetFirewallRule | where { $_.Name -Like "*.exe" -and -not(Test-Path -Path $_.Name.Split('}')[1]) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add
| %{ Remove-NetFirewallRule -Name $_.Name -WhatIf }
to remove stale rules (remove-WhatIf
for actual removal)