How can I easily push out a new c:\windows\system32\drivers\etc\hosts file to my workstations?


I've try this as my "Command to Run":

copy "\\Server\PDQ\hosts"  "C:\Windows\System32\drivers\etc\hosts" /Y

But it fails.  I can edit this file on every workstation using \\workstation\c$\windows\system32\drivers\etc\hosts, but I just want to overwrite it.  Does this file have special read-only permissions?

<sigh...this is so easy in the Unix world>



Date Votes
  • Aaron,

    It may be that the deployment credentials can't access the server share.  You can try adding the hosts file as an "Additional File".  It will be copied down to the target computer and then you can do the copy from there, so that the target computer doesn't need to connect to the share.

    copy hosts "%windir%\System32\drivers\etc\hosts" /Y

    If you're still having an issue you can capture the output from the command to see if there's something else blocking the copy:

    copy hosts "%windir%\System32\drivers\etc\hosts" /Y > c:\copy.log 2>&1

    This will put a file called copy.log in the c:\ directory on the target computer where you can read any error messages.

  • When you say "You can try adding the hosts file as "Additional File" do you mean put it in the "Files to include" field?

  • Yes, that's correct.  The label was changed and I was using the old name.

  •  Hmmm....didn't help.  I even thought it was a pro versus free version thing and upgraded to Pro.  Didn't help at all.

  • Did you try to capture a log file?  I just noticed I had a typo in the syntax, it should end with 2>&1 instead of 2&>1 (I corrected the original comment).

    copy hosts "%windir%\System32\drivers\etc\hosts" /Y > c:\copy.log 2>&1
  • When I corrected that syntax, it looks like it worked. 

    1 file(s) copied.

    Thanks dude!  


Please sign in to leave a comment.

Didn't find what you were looking for?

New post