Access denied trying to copy hosts file to local using logon vbscript.
Posted on 2005-05-11
I wish to use a logon script to replace local hosts file with a customized one. i'm new to vbscripting. It works using excel file but doesn't like hosts or host.txt. it will copy host.txt by using *.txt in the script. I'm guessing it has something to do with the fact that it is in system32 child folder. Here is the sample of my script:
Set objFso = CreateObject("Scripting.FileSystemObject")
objFso.CopyFile "\\homer\everyone\hosts", "c:\windows\SYSTEM32\DRIVERS\etc"
Set objFso = Nothing