Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Edit the host file using group policy?

Posted on 2008-10-06
9
22,773 Views
Last Modified: 2012-05-05
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
Comment
Question by:Shibint
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 70

Expert Comment

by:KCTS
ID: 22649369
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
 

Author Comment

by:Shibint
ID: 22649559
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
 
LVL 16

Expert Comment

by:robrandon
ID: 22649563
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 70

Expert Comment

by:KCTS
ID: 22649665
... 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
 

Author Comment

by:Shibint
ID: 22649878
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
 
LVL 16

Expert Comment

by:robrandon
ID: 22650134
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
 
LVL 5

Expert Comment

by:scadieux
ID: 22658328
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
 
LVL 5

Accepted Solution

by:
si_shamil earned 250 total points
ID: 22684061
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
 
LVL 5

Expert Comment

by:scadieux
ID: 22920875
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question