Error DataBase-One Place all Solutions Forums Blog Glossary    Contact Us
Search  
   
Browse by Category
Error DataBase-One Place all Solutions .: Operating Systems .: Windows Operating Systems .: Windows 2003 .: How to Deploy HOSTS file using Group Policy?

How to Deploy HOSTS file using Group Policy?

I know this is an old topic but there is a very simple way to achieve this. In fact this method, with a few altercations, may be used to deploy any file via GP.

1) Create a share on your network

i.e. \\server\hostsDeploy\

2) Copy the 'hosts' file you wish to deploy into the share.

i.e. \\server\hostsDeploy\hosts

3) Create a file called 'deployHosts.cmd' in the shared directory.

i.e. \\server\hostsDeploy\deployHosts.cmd

4) Edit the 'deployHosts.cmd' file so that it reads:

@echo off
copy \\server\hostsDeploy\hosts %SystemRoot%\system32\drivers\etc\hosts

5) Set the script to run as either a computer startup script or a user logon script within group policy.

i.e.

As a computer startup:
a. In the Active Directory Users and Computers MMC snap-in, right-click the domain name, and then click Properties.
b. Click the Group Policy tab.
c. Click New to create a new Group Policy object (GPO), and type Hosts Deployment for the name of the policy.
d. Click the new policy, and then click Edit.
e. Expand Windows Settings for Computer Configuration, and then click Scripts.
f. Double-click Logon, and then click Add.

The Add a Script dialog box appears.
g. In the Script Name box, type \\ServerName\hostsDeploy\deployHosts.cmd.
h. Click OK, and then click Apply.

As a user logon script:
a. In the Active Directory Users and Computers MMC snap-in, right-click the domain name, and then click Properties.
b. Click the Group Policy tab.
c. Click New to create a new GPO, and then type Hosts Deployment for the name.
d. Click the new policy, and then click Edit.
e. Expand Windows Settings for User Configuration, and then click Scripts.
f. Double-click Logon, and then click Add. The Add a Script dialog box appears.
g. In the Script Name box, type \\ServerName\hostsDeploy\deployHosts.cmd.
h. Click OK, and then click Apply.

NOTE: The default hosts path for Microsoft Windows (NT/2000/XP/2003/Vista) systems is '%SystemRoot%\system32\drivers\etc\'

For Microsoft Windows (95/98 and 98SE/Me) the defualt path is '%SystemRoot%'

For Unix-like systems, including Mac OS X, GNU and Linux systems the defualt path is '\etc'

How helpful was this article to you?

Related Articles

article How to use Group policy to Deploy Outlook 2007
If you decide to use Outlook as the client...

(No rating)  4-11-2008    Views: 165   
article How to control Encrypting File System (EFS) using Group Policy in 2008 server
Using Group Policy to control where EFS can...

(No rating)  4-24-2008    Views: 155   
article How to Manually install a a Hosts File
The most important thing to do before using...

(No rating)  3-17-2008    Views: 129   

User Comments

Add Comment
No comments have been posted.