Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 24463
  • Last Modified:

Edit the host file using group policy?

I want to edit the host file of all my users computers .Following is my requirement

1, Want to edit the host file , in which i want to change the IP address but the host name will remain same.
2, Need to deploy using group policy to all my domain users with out user intervention.

Any more details require please let me know.
0
Shibint
Asked:
Shibint
  • 2
  • 2
  • 2
  • +2
1 Solution
 
KCTSCommented:
You can script this and then assing the script with a GPO but there is no way to do this directly with a GPO

Why do you want to do this ? Why not make an entry in DNS - job done !
0
 
ShibintAuthor Commented:
because there is already an entry is there in host computer with the same host name.

Do you have any script available?  Do it requires admin right to modify the file.

Regards

Shibs
0
 
robrandonCommented:
Instead of trying to edit the hosts file, just use your script to copy a new one.  Such as

copy \\server\share\hosts to c:\windows\system32\drivers\etc

KCTS has a good point though - why not just create an A record in DNS?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
KCTSCommented:
... Yes you will require admin rights to edit this file - and some AV software may also object.

...best option in the long run - delete the hosts file and use DNS for the purpose it was intended.
0
 
ShibintAuthor Commented:
I have 1500 computers are there in the domain.it's really impossible to do a manual process. Is there any work around without admin right. Also can you please send me some script model.
0
 
robrandonCommented:
Package the Hosts file in an MSI file and then deploy that as an application through Group Policy.

http://www.windowsnetworking.com/articles_tutorials/Group-Policy-Deploy-Applications.html

0
 
scadieuxCommented:
The easiest way to do it is create your host file and deploy it with a startup script which doesn't require that the user has admin rights since it runs on machine account.
Put your host file on a share and create a batch file with this line:

copy \\server\sharename\hosts c:\windows\system32\drivers\etc /y

The /y switch will allow you to overwrite the file.
Then go in your group policies:
Computer configuration / Windows settings / Scripts / Startup
and use your script. At next startup everyone will have new hosts file.

0
 
si_shamilCommented:
scadieux's is a best option, just couple of points:

1: Do not use hardcoded path use "%systemroot%\system32\drivers\etc\hosts" instead
2: if you dont want to overwrite user's file, use this command to append to existing host file:
type \\server\sharename\hosts >> %systemroot%\system32\drivers\etc\hosts
0
 
scadieuxCommented:
The accepted solution says that my method is the best and gives other options to improve my method. I think that points should have least been splitted since the original solution comes from me, no? lol
1

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now