I have a host file I need to copy to all my workstations. I have a scrip that which is below. I have the host file in a share that everyone can access and I also put the batch file in that share. I created a Group Policy startup script and pointed the location to \\US-data\it$\private\hostfile\hostsfile.bat but when I reboot my machine, the reg key gets applied but it does not copy the host file.
I know the batch file works as if I run it locally on my workstation, it copies the host file to my local machine and it creates the regkey. So why is it not working.
---------------------------------------------------------------------------------------------------------------------------------------------------
:keyverify
reg query HKEY_LOCAL_MACHINE\SOFTWARE\esahostfile
if %errorlevel%==1 (goto copyhost) else (goto End)
:copyhost
xcopy /Y \\US-data\it$\private\hostfile\hosts %systemroot%\System32\drivers\etc\hosts
reg add HKEY_LOCAL_MACHINE\SOFTWARE\esahostfile
:End
---------------------------------------------------------------------------------------------------------------------------------------------------