Skip to content

Instantly share code, notes, and snippets.

@alimbada
Created February 22, 2023 12:49
Show Gist options
  • Save alimbada/cb3dd5963f31347a51e3483a7fb7df2c to your computer and use it in GitHub Desktop.
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.
Get-NetFirewallRule | where { $_.Name -Like "*.exe" -and -not(Test-Path -Path $_.Name.Split('}')[1]) }
@alimbada
Copy link
Author

Add | %{ Remove-NetFirewallRule -Name $_.Name -WhatIf } to remove stale rules (remove -WhatIf for actual removal)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment