Host File

Is it possible to edit the windows host file through group policy?
binumhaneefAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
There is no direct way you can you Group Policy to edit Windows host files. Why are you doing this? Is DNS not abel to accomplish the purpose.

There is a VB script that you use, though I have not tested it, please test this in your development enviroment first.

http://www.codeproject.com/Articles/11354/VBScript-for-reading-and-writing-to-the-Windows-ho

Regards
0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Doing it thru scripting should not be an issue. VBS or PowerShell will both come handy here. Even conventional cmd batch scripting should work, depending on the demands.
0
binumhaneefAuthor Commented:
In our branch we have static ip address so we need to change the host by group policy if possible
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
DNs works very well with static IP addresses, and makes life much easier as it is kept up-to-date automatically.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sanjay SantokiCommented:
Hello,

There isn't any way to do it through Group policy but logically here is the workaround if you are going to replace same host file on each machine;

Create a HOST file and save it on network location -> Create a Batch file which includes copy command to copy HOST file from network locations to the C:\Windows\System32\Drivers\Etc
Put it under startup through group policy

Regards,
Sanjay Santoki
0
N-WCommented:
Is it possible to edit the windows host file through group policy?

Yes you can, quite easily.

First place the host file on a network share that the required users have access to.

Under Computer Configuration\Preferences\Windows Settings\Files, add a new file item.
For Action, select "Replace".
For Source file(s), enter the full UNC path of your shared host file (for example, "\\SERVER1\Share\hosts".
For Destination File, enter "C:\Windows\System32\Drivers\etc\hosts".

Run gpupdate /force on the target machines (or just reboot) and the host file should update automatically.

Having said that, I agree with the other posters that setting up a DNS server would be a much better solution in this case.
0
David Johnson, CD, MVPOwnerCommented:
Fix your dns issues so you don't need to use the hosts file.. what you are doing is recreating 1980's technology.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2012

From novice to tech pro — start learning today.