This article is mostly a brain training exercise.
Let’s make sure that a block outbound rule has appeared in the Windows Firewall console. I have added the –NoHostsFile parameter to the Resolve-DnsName cmdlet in order not to use the hosts file for resolving. New-NetFirewallRule -DisplayName "Block Web Sites" -Direction Outbound –LocalPort Any -Protocol Any -Action Block -RemoteAddress $IPAddress $IPAddress = $SitesToBlock | Resolve-DnsName -NoHostsFile | Select-Object -ExpandProperty IPAddress So you can now add a blocking rule to your Windows Firewall for multiple websites at once: New-NetFirewallRule -DisplayName "Block Site" -Direction Outbound –LocalPort Any -Protocol Any -Action Block -RemoteAddress $IPAddress $IPAddress = Resolve-DnsName ""| Select-Object -ExpandProperty IPAddress Thus, you can convert the name of the website into its IP addresses and add a block rule to the firewall settings: Resolve-DnsName ""| Select-Object -ExpandProperty IPAddress In order not to resolve the website names into IP addresses manually, you can use the Resolve-DnsName PowerShell cmdlet to get the website IP addresses:
You can find it in the graphical interface of your Windows Defender Firewall. The string “The rule was parsed successfully from the store” means that the new Firewall rule has been successfully applied. New-NetFirewallRule -DisplayName "Block Site" -Direction Outbound –LocalPort Any -Protocol Any -Action Block -RemoteAddress 104.244.42.129, 104.244.42.0/24 You can also create a Firewall rule that blocks the connection to the website using PowerShell: Using PowerShell to Create Firewall Rule to Block Website by Domain Name or IP Address It is better to filter websites on your Internet access router (gateway). In your AD domain you can deploy a Windows Firewall policy to block access to a website on user computers using GPO.
The following message will appear in your browser when trying to connect to the blocked site: Unable to connectįirewall or antivirus software may have blocked the connection Then specify the rule name and save it.Īfter that Windows Defender Firewall will block all outgoing connections to the specified website’s IP addresses. Leave all options as they are in the window with Firewall profiles the rule is applied to. In the next window, enter the IP addresses, subnets or a range of IP addresses you want to block.Ĭlick OK -> Next -> Action -> Block the connection.
How to Block Website IP Address in Windows Defender Firewall?Īlso, you can block some websites using the built-in Windows Defender Firewall.