Are your children always using Facebook? Or is your brother always using your computer?You will find here a way to control access to websites at certain times.
We will do this in Windows 7 but you can do it in all Windows versions.
This post will use the hosts file and two tasks. The host file is stored in %SystemRoot%\system32\drivers\etc\ and its function is mapping host names and IP addresses. Before DNS or WINS act the local host do this mapping so is the ideal place for controlling access to Web Pages.
So let start:
Press WinKey + R, type %SystemRoot%\system32\drivers\etc\ and press Enter. You will see something like this:
Copy and paste the file twice so you will see this:
Create a new folder named c:\hosts. Move the two copies of the host file and rename it to host.tmp1 and host.tmp2.
Press WinKey + R, type notepad and press Enter, drag and drop host.tmp1 to the open window:
Add the following line to the file 127.0.0.1 www.facebook.com and save it.
Now, when your browser looks for facebook.com it will be redirected to your local machine, making the connection impossible.
The idea behind is using the host file that blocks Facebook whenever you want. We also have to create 2 files, that are going to copy the 2 versions of the host file.
For that reason we open a new notepad, use WinKey + R, type notepad and press Enter.
Type the following line:
xcopy /Y hosts.tmp1 hosts
and save it to “1.bat”, don’t forget to use the quotes:
Repeat the same with host.tmp2 and create a file named 2.bat. The command line is xcopy /Y hosts.tmp2 hosts. Now we have the files that are going to copy the versions of host file when we want. Copy these 4 files into %SystemRoot%\system32\drivers\etc\ so you finally have these:
We are going to use the Task Scheduler to execute the bat files.
Type Winkey + R type taskschd.msc /s and press Enter. On the right pane click create basic task. Name it as Restrict Access. Select Daily. Now enter the time you are going to restrict the access to facebook.com. In our case 8:00 pm. Select Start a program and look for 1.bat. You have to type the folder the task is going to start %SystemRoot%\system32\drivers\etc\:
Click on “Open the properties dialog for this task when I click Finish“ and press finish. Select the following options:
Repeat the same for 2.bat, but in this case use the time you want to start using the Web Page, for example 5:00 pm.
There you have it, access to websites blocked at certain times.
If you’re not into scripting or doing things as manually as this, be sure to check out the User Accounts and Parental Controls Series (written for Vista but also works for Windows 7.)
About Angel Luis
I am an Engineer of Telecommunications that love computers. My first computer was a Commodore 16kb, about 25 years ago and since then I am always fighting computers problems. Please visit my entries and ask me about whatever problem you have, I will be pleased to help you. My email is discoveryourpc [at] gmail [dot] com. You can follow me on twitter @agenlu or read my blog www.discoveryourpc.net
- Web
- |
- More Posts (48)
thanks for the knowledge…
pure excellence
Thank you for the comment.
I tried these instructions but my system is XP. I got a Blue Screen. Yikes!!! Should this work with XP?
I haven’t personally tested this on XP but it should work. Can you check the system log and give us the details of the blue screen in the forums? We can help you troubleshoot from there.
Thanks for the comment Sal. Please go to the forums and let us know what has happens. It should work on Windows XP.
hi, good article but i’m having some trouble with it at the moment. For some reason the bat file wont run, even if i try to run it manually within the %SystemRoot%system32driversetc folder. I am using my admin acct but everytime I click on either 1.bat or 2.bat a screen pops up and says access denied. if anyone can help me out with this it will be much appreciated. thanks
I think that your problem is related to how Windows 7 acts about the security in that folder.
If you are an admin you can change the properties on the Security tab so you are not going to have problems with that.
If you are still having problems please leave a comment and I will change the article.