Created
September 15, 2025 10:56
-
-
Save jumoog/5f578a775508335f1548edc7141018f2 to your computer and use it in GitHub Desktop.
block all exe files in a folder recursive
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-ChildItem -Path "C:\Path\" -Filter *.exe -Recurse | | |
| Select-Object Name, FullName | | |
| ForEach-Object { | |
| New-NetFirewallRule -DisplayName "Block $($_.Name) Inbound" -Direction Inbound -Program "$($_.FullName)" -Action Block | |
| New-NetFirewallRule -DisplayName "Block $($_.Name) Outbound" -Direction Outbound -Program "$($_.FullName)" -Action Block | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment