[Webinar] Streamline your web hosting managementRegister Today

x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 8607

# Batch file creation to copy files across network.

I created a simple 4 line batch file to copy 4 files from a file server to a location on the C: drive of each user in my network. I placed the batch file into the profile tab of each users properties window within ADUC.

The batch file is running properly at startup however only one of the 4 files is copied when it is run. The rest of the copy commands receive a Access Denied message. I checked the permissions of the folder where I am pulling the 4 files and everyone is set to read access so they should be able to access this folder.

If I attempt to run the batch file manually while the user is logged in under their account it only copies one file, however if I log in as myself with domain admin priveledge all 4 files copy. Attached is the code I am using in the batch. Please note, pause command was added simply for troubleshooting purposes. I understand that this may not be the best way to migrate files to multiple users, however it was the only way I knew of. If there is another way (through a group policy or whatnot) to do this, I am open to suggestions. Any help would be appreciated. Thank you.
copy "\\stmedstore\store\user\information technology\it\ics icons\prod\client.pf" "C:\WorkQ91c\Prod" /y
copy "\\stmedstore\store\user\information technology\it\ics icons\train\client.pf" "C:\WorkQ91c\train" /y
copy "\\stmedstore\store\user\information technology\it\ics icons\newtest\client.pf" "C:\WorkQ91c\newtest" /y
copy "\\stmedstore\store\user\information technology\it\ics icons\oldtest\client.pf" "C:\WorkQ91c\oldtest" /y

pause

0
• 3
• 3
1 Solution

Commented:
I have run into similar problems where the second directory accessed is denied, but the first is allowed.

Things to try --

1.  before each copy command, CD to the directory on the server -- i.e. DOS batch CD command
2.  Try running each command as a separate batch file.  You will have a single master file, update.bat

Update.bat
@echo off
run copyfile1.bat
run copyfile2.bat
run copyfile3.bat
run copyfile4.bat
@echo on
exit

Then each copyfile1-4.bat is each one of your 4 command lines above.

Try that, see what happens.
0

IT ConsultancyCommented:
If the user does have read to all those files (got to START | run and type \\stmedstore\store\user\information technology\it\ics icons\ as the user.  Can you go into the directories and copy the file locally?

I imagine the user doesn't have write rights to C:\WorkQ91c\oldtest etc?

Try changing the destination to %temp% and see if that works, that would prove the copy works as the user from the source and that it is destination permissions

Steve
0

Author Commented:
Steve, The local rights on the C:\WorkQ91c\ folders seem to be the problem. Many users do have access to this folder, although many do not it seems. When I changed the destination to %temp% as you suggested it worked on all 5 of the users that I attempted it on. Of those 5, none of them had been able to run the previous batch. Is there an easy to change the local permissions for this folder globally throughout my domain, so that when the users run this batch, the files work properly?
0

IT ConsultancyCommented:
You can set permissions using a group policy or you could run a script across all your PC's.  I think this explains it quite well, have a look and come back with any issues, sorry but haven't got time right now to write out an explanation myself:

http://technet2.microsoft.com/windowsserver/en/library/1687ef1d-b382-49c7-b184-a4cc888be5251033.mspx?mfr=true

steve
0

Author Commented:
No problem, will look at this now. Thanks for your help.
0

Author Commented:
This worked for me. Thanks.
0

IT ConsultancyCommented: