Martyn Apr 22, 2017 @ 11:34am
HOWTO: Auto-Generate Outbound Windows Firewall Rules for All Steam Games
Figured I would contribute this for those who like to have locked down/secure systems but also want well-functioning Steam games.

This script assumes you have a portable Steam install on a separate disk (in my case B:\Steam)

To use this, crack open PowerShell as Administrator and have at it. The first part removes only firewall rules added by this script, the second part scans for executables in the Steam folder, the third part adds firewall rules for allowing $program outbound to any IP/port.

Took me 10 minutes to make, as I like to sandbox everything on Windows, especially video games since DRM tends to be a privacy nightmare.

I have only tested this script on Windows 10, but in theory it should work on Windows 8.1 as well. This will NOT work on Windows 7 (sorry, but technology has moved on).

If you need Inbound rules, copy/paste the New-NetFirewallRule line with -Direction Inbound. But, as security is my goal, I do not want unnecessary inbound connections on potentially insecure games (think: UT GOTY servers with known buffer overflow exploits!)

## Begin PowerShell Script

Write-Host "[STEP 1/3] Removing old video game firewall rules.."
Get-NetFirewallRule -Group "Video Games" | Remove-NetFirewallRule

Write-Host "[STEP 2/3] Gathering list of game executables...."
$Items = Get-Childitem -Path B:\Steam -Recurse -Filter *.exe

Write-Host "[STEP 3/3] Adding new video game firewall rules..."
foreach ($Item in $Items) {
$Program = $Item.VersionInfo.FileName
$Description = $Item.VersionInfo.ProductName
New-NetFirewallRule -Group "Video Games" -DisplayName "Video Games - $Program" -Description $Description -Program $Program -Direction Outbound -Profile Any -Action Allow
}

## End PowerShell Script
Date Posted: Apr 22, 2017 @ 11:34am
Posts: 0