Block a Website or IP: There are many websites on the Internet. We have millions of websites in all languages and with a wide range of topics. There may be times when we are interested in blocking a specific site. We want it to not open when you open your browser and enter your address.
We can do this in different ways. For example, we may use third-party firewalls and other tools. This will prevent our system from accessing a specific site. However, the operating system itself also has the tools to achieve the same goal in a simple and fast way.
That’s wherePowerShellcomes into play. We can use it to take a series of steps and block access to both a specific website and an IP address. You just need to do some simple actions that we will explain.
How to Block a Website or IP Page Using PowerShell
We’ll explain how to block the IP address of a webpage from PowerShell. Keep in mind that we can block a specific IP or a number of addresses. The first thing we do isstart, writePowerShelland run it as an administrator.
The command to be executed is as follows:
New-NetFirewallRule -DisplayName -Block NAME.com IP address -Direction Outbound -LocalPort Any -Protocol TCP -Action Block -RemoteAddress ADDRESS
From this command, you only need to change two things: NAME and ADDRESS. In the title you must specify the website, domain; We will list the IP addresses of this website to the address. Later we will only have to give it to execute and the process will begin.
In our example, we tested a random site that we found on the Internet. The goal was simply to prove that it worked properly. Once launched, we can open Google Chrome, Mozilla Firefox, or any browser to see if the page loads. As shown in the figure below, a message will appear.
We can also access the InternetWindows firewalland check the output rules to make sure it is properly blocked. The page we’ve chosen to block appears. You can even right-click it to disable the rule. This way, we will be able to access this site again without any problems. The change is immediate.
In short, by following these steps, we canblock accessto any domain on the Internet in a simple way. It’s basically the same as creating a rule in Windows Firewall.
In this case, however, just run the code we mentioned, change the parameters and that’s it. We will no longer have to waste time creating rules of any kind.
As previously reported, we can also access the operating system firewall to check if the rule or rules that you created were actually saved.
In this way, we can ensure that they are really active. We can always cancel the action, and this way we can access the site we decided to block at the time.
Remember that this block will be present in every browser. It’s not something that can only affect Google Chrome or the main browser we use, but it will be present in anything we install. Finally, our system blocks access to this site or IP address.