Last active
May 14, 2025 23:49
-
-
Save shmuel-raichman/08ae89cbc9c174f984c132298a758bc7 to your computer and use it in GitHub Desktop.
create FW rules from a list of exe files (in this case razer)
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
# B"H | |
$execListFile = "C:\...\powershell\exe-list.txt" | |
$ruleBaseName = "block-razer-" | |
foreach($line in Get-Content $execListFile){ | |
$exeName = [System.IO.Path]::GetFileNameWithoutExtension($line) | |
$ruleName = $ruleBaseName + $exeName | |
Write-Host "Creating rule: $ruleName" | |
Write-Host "Program path: $line" | |
New-NetFirewallRule -DisplayName $ruleName -Direction Inbound -Program $line -Action Block | |
New-NetFirewallRule -DisplayName $ruleName -Direction Outbound -Program $line -Action Block | |
} | |
# To get a list of exe files for diractory | |
# Run this in WSL (bash for windows) | |
# cd /mnt/c/YOUR_PATH | |
# find . -name *.exe > exe-list.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment