 |
Automatic Hosts File Update Script
|
Sort, add, and remove entries from your hosts file.
Automatic Hosts File Update Script
The HostsInstall script
is configured to download, merge, sort, and remove duplicate entries from several different
popular online "hosts" files. Here's a few features:
- It's Vista-aware! Admin users on Vista are given a "User Access
Control" (UAC) prompt to insure the script runs with admin priveleges.
Non-admin users on Vista, XP, and W2K are automatically presented a
"RUNAS" prompt to allow them to log in as an administrator.
- Configuration is via simple tab-delimited plain-text files you can edit with Notepad
- You get the usual "whitelist" and "blacklist", but you can also
specify things like your blackhole IP, lists of real hosts, and
the list of web sites that provide hosts files.
- Merging and sorting happens extremely fast thanks to running
everything through a database. No, a separate database program or
complex setup is not required! The script handles everything.
- Your "DNS Client" service (which must not be running!) is checked
every time the script is run. If the DNS Client service is running, the
script will offer to stop and disable it for you.
- To make it easier for you to search your "hosts" file, the script
sorts it by domain name. This means entries like "www.bad.com" and
"bad.com" will be next to each other rather than at opposite ends of
the hosts file.
- Rather than try to preserve comments from all the differing hosts
providers, all comments are removed. New comments are added to the
beginning of the generated hosts file to remind you of the location of
the original script and the location of the configuration files.
- Finally, (and most importantly) this is an open-source script
you're free to modify and redistribute!
Manually Installing a Hosts File
If you'd prefer to manually
install a hosts file yourself, I recommend you look at these sites:
http://www.mvps.org/winhelp2002/hosts.htm
http://en.wikipedia.org/wiki/Hosts_file
http://www.hostsfile.info/
http://hosts-file.net/
The most important thing to do before using large HOSTS files is to disable the Domain Name
Service client
("DNS Client" or "DnsCache") service on your machine. It sounds
bizarre, but the DNS client isn't
needed to do DNS. Worse, if you have a large HOSTS file (which is what
I suggest), the DNS client chokes your entire PC. The DNS client acts
as an intermediate step looking up (and remembering) internet names and
addresses on your PC. If you disable the DNS client, you may need to
let your firewall software know that individual applications are
allowed to do DNS lookups. Other than that, no problems. Microsoft has an article
that tells you how to disable DNS caching by the registry. They mention
the services control panel as an easier way, but they don't tell
beginners how to do it! Here's
how to do it.
You
need to open up the "Services" configuration window. From the "Start"
button, select "Run", and enter "services.msc". There are other ways to
do this, of course (aren't there always?), but this is the
simplest. |
Scroll down the list to the "DNS Client" (shown highlighted
here). Under the "Startup Type", it should show "Disabled". If it
doesn't, double-click the entry to open it's "Properties" window. |
Select
"Disabled" from the list of choices for "Startup type". If the
"Stop" button isn't grayed out (it's grayed out in this picture), press
the "Stop" button to stop the DNS Client service.
Now you can install and use a really large HOSTS file on your PC! |
Lost? Look at the site map.
Bad links? Questions? Send me mail.