Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

objFSO.CopyFile Permission problem

Status
Not open for further replies.

eseabrook2008

Technical User
Jan 9, 2008
74
CA
I'm trying to copy the contents of a remote folder to a local folder and overwrite the local contents. I'm running the script at logon via GPO. I get a permission error when the CopyFile command runs. The users do not have permission to edit the contents of the folder (if i log on as an administrator, the script runs fine). I've tried changing the permissions via a GPO but that doesn't seem to work. Is there something I can change in my script to run with higher privileges?

Dim objFSO
Dim strLocalDir, strNetworkDir, delLocalFile
strLocalDir = "C:\MCCG\IBSNT\BIN"
strNetworkDir = "\\xxx\public\IBSFILES"

' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set delLocalFile = objFSO.GetFile("c:\mccg\IBSnt\bin\ibsnt.exe")

' Check that the Directories exists
If objFSO.FolderExists(strLocalDir) Then
If objFSO.FolderExists(strNetworkDir) Then
delLocalFile.delete
objFSO.CopyFile "\\xxx\public\IBSFiles\*", "C:\MCCG\IBSNT\BIN\"
End If
End If
 
Set up your GPO to run the script at startup (computer portion of GPO). The script will then execute under the "SYSTEM" credentials, allowing the file to be copied.

Make sure that access to \\xxx\public\IBSFILES is granted to either "Authenticated Users" or "Domain Computers" so that the system can get the file from the source.

Good Luck!

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Thanks PSC,
Had to do that AND move the computers to an OU by themselves and apply the GPO there. Seems to work now! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top