XCOPY or ROBOCOPY wont run in batch file

I have this old batch file that I used to upgrade a software and since it is time for another one I have tried creating a GPO and assigned it under User Configuration>Windows Settings>Logon.

But when testing with a user logging on the batch file wont run but when manually clicking the file it runs perfectly fine!

Here is the code:  xcopy "Source" "Destination" /S /C /I /H /R /Y

Users have a full time mapped drive from where the source file is copied to the local drive C:\Folder

Note that robocopy is the same and doesn't run automatically.
Bogart BogartAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITEnd-user supportCommented:
In your bat file, add this to check if mapped drives and dirs exist:
net use >> "c:\%temp%\logon_debug.txt"
echo Checking for Source dir...
dir "c:\SourceNameHere">> "c:\%temp%\logon_debug.txt"
echo Checking for Target dir...
dir "c:\TargetNameHere">> "c:\%temp%\logon_debug.txt"

Open in new window

Logon the user.

Review the file on user's station: "c:\%temp%\logon_debug.txt"
Bogart BogartAuthor Commented:
Hi NVIT, I just came back and revisited the still logged on user and I am seeing it happen just now and files are flying!

I don't know what's causing the delay?

My expectation was for the files to be copied and dos window to be up as soon as user is logged in.

NVITEnd-user supportCommented:
Not sure on the delay cause. How long did you wait? Maybe try another user to time it.
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

Bogart BogartAuthor Commented:
Over 10 minutes which isn't really good. I will try with another user and will let you know.

It's a 3+Gb file and taking so long though. May have to try Robocopy as this could be a lot faster.

Otherwise will have to make this a logoff process.
Bogart BogartAuthor Commented:
Ni NVIT just logged in another test user and the batch file does work but it starts after 4 minutes of wait.

I am not sure where the delay is coming from
Bogart BogartAuthor Commented:
I am testing this on a Win8.1 and seems to be a policy setting set to a default of 5 minutes! Will test this on a Window 7 and see how I go.
Bogart BogartAuthor Commented:
Hi NVIT this problem is solved.

I have verified this on a Windows 7 machine and the culprit is the policy: Computer Configuration\Administrative Templates\System\Group Policy: Configure Logon Script Delay which is set to Not Configured and is by default to wait for 5 minutes.

Thanks for looking into this.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NVITEnd-user supportCommented:
Awesome, Bogart!
I'm glad you figured it out.
Can you set it to 1 minute?
Bogart BogartAuthor Commented:
Hi NVIT from what I've read it can be set to whatever you like.
NVITEnd-user supportCommented:
1 is faster than 5. Hehe
Bogart BogartAuthor Commented:
Hah it is indeed!
Bogart BogartAuthor Commented:
This is know issue with 8.1 and is controlled in the mentioned GPO settings
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.