Introduction
In this guide, we will show you how to block certain domains using Windows Firewall rules.
Requirements
- Windows operating system
- PowerShell
Step 1: Identify the FQDN (Fully Qualified Domain Name)
Replace example.com with the domain you want to block.
Step 2: Create a Firewall Rule
$fqdn = "example.com"
$id = "{+(New-Guid).ToString()}"
New-NetFirewallRule -DisplayName "Block $fqdn" -Direction Inbound -Protocol TCP -LocalPort 80 -Action Block -Name $id
New-NetFirewallRule -DisplayName "Block $fqdn" -Direction Inbound -Protocol TCP -LocalPort 443 -Action Block -Name $id
Step 3: Save the Rules
These commands will create two rules: one for HTTP (port 80) and one for HTTPS (port 443). Save the rules and restart your computer for them to take effect.
References
` tags, and the code inside them is properly formatted according to the programming language, including indentation and tabulation. The output is a valid HTML document that can be opened in any web browser.