Updates Host file on computer accounts


  • Hi,

    I have created a batch file and used it as a startup script via group policy on my environment and I am successfully able to replace the existing host file with the new one. I am using the following command in my bacth file

    copy \\share\host\ %windir%\system32\drivers\etc\hosts /y

    Is it possible to only edit the current host file rather than replacing them ?

    Monday, February 08, 2016 5:07 AM


All replies

  • Group Policy does not have such a feature natively.

    you would need to write a script (or find one) which can perform the function you wish, test that, and then you could deploy the script using GPO startup script policy.

    For assistance with scripting, you can ask in the scripting forums

    Don [doesn't work for MSFT, and they're probably glad about that ;]

    Monday, February 08, 2016 8:29 AM
  • Hello,

    If you want to edit the existing file, the following link should be helpful for you:

    add remove entry from hosts file of remote machines


    Yan Li

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact

    Tuesday, February 09, 2016 7:49 AM