How to block all executable files in a folder
Overview To create a Windows firewall rule that blocks all .exe files located within a specific folder, you may use the following powershell command: Get-ChildItem -Path "C:\Program Files (x86)\Apps" *.exe | 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}