1

Would it be possible to use robocopy to copy the host file from one server to multiple servers (less than 10 total)?

We have servers that rely on having identical host files and this would be convenient. Also is it possible to schedule robocopy and have it execute in a bat file to be run on-demand? Or is there a better solution?

The servers are Windows 2003/2008.

hsatterwhite
  • 322
  • 2
  • 5
  • 14
  • 1
    Do you actually need it to "sync" i.e. someone could make changes on ANY server and the rest will receive updates, or do you just need it copied from a specific server to the others. – SpacemanSpiff Sep 02 '11 at 14:00
  • You should be able to. And yes you should be able to schedule it. Have you tried it? I know with Windows 7 you need to escalate the privlages because `c:\windows\system32\drivers\etc` is protected. – Nixphoe Sep 02 '11 at 14:01
  • @SpacemanSpiff: I guess sync'ed was used in the wrong context. We just need it copied over from one specific server to others. – hsatterwhite Sep 02 '11 at 14:03
  • @Nixphone I have not yet had a chance to try it. I presumed there would be some catch to copying host files over, which is why I'm here asking the experts. :) – hsatterwhite Sep 02 '11 at 14:04
  • What is wrong with DNS? – 84104 Sep 02 '11 at 17:12
  • Nothing wrong with using DNS, but we rely heavily on host files for certain parts of the infrastructure. – hsatterwhite Sep 15 '11 at 19:48

1 Answers1

2

I would suggest using a DNS server instead of distributing a HOST file. However, if you must; yes, one-to-one is what robocopy is good at; there are much more efficient replication methods that would be much better: DFS-R, FRS, and rsync to name a few.

To save a robocopy job, you could opt to use the /save: argument, then the /job argument to recall the job that was saved.

I would, however, suggest simply writing a BAT, and using a scheduled task.

mbrownnyc
  • 1,825
  • 8
  • 30
  • 50
  • Thanks for the answer. Unfortunately we do have to rely on host files here. I wish we could fall back on DNS like you're supposed to. I'll read in to the other solutions mentioned. – hsatterwhite Sep 02 '11 at 14:15
  • Using HOST files is fine, but can get get complex and annoying to manage in a distributed environment (ex: your situation). – mbrownnyc Sep 02 '11 at 14:17
  • as mentioned...BAT file with the robocopy command and scheduled task. Use one BAT file on the "source" server to run multiple robocopy lines for each "target" server. Make sure you only update the source server of course. – TheCleaner Sep 02 '11 at 14:18
  • That's pretty much what I was getting at. – SpacemanSpiff Sep 02 '11 at 14:22