GPO applying but logon script not working

Hi,

We are trying to push a login script using the GPO. The script is to copy the default folder of Google from the roaming profile to the local AppData. It is an Xcopy command. I have converted it into a batch file and copied the batch file to the netlogon and sysvol folder. The GPO is applied but does not run the batch file.

The batch file works by itself and also when we copy the batch file to the startup folder in roaming profile it works. All the other policies are working except this.

We use windows 10 and Server 2012 r2

Please provide any advise.

Regards,

Ajoy
LVL 1
Ajoy RajanSenior IT AdministratorAsked:
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:
Where on the gpo tree is the script running?
Ajoy RajanSenior IT AdministratorAuthor Commented:
The ICT Operations team OU. It is linked to the right OU.
NVITEnd-user supportCommented:
But when you edit the gpo/gpp itself. Is it in the Computer or User branch? Since you want to run it during login, i presume it should be in the User branch.

But where, specifically?
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Ajoy RajanSenior IT AdministratorAuthor Commented:
It is in the user branch. Currently for ICT users.
NVITEnd-user supportCommented:
Is your script added to: User Configuration > Windows Settings > Scripts > Logon
Ajoy RajanSenior IT AdministratorAuthor Commented:
yes it is.
NVITEnd-user supportCommented:
> ...The GPO is applied but does not run the batch file.

How are you certain the script even running at all? To be certain, troubleshoot each line of the script to see where it may be failing. Above each command line, place ECHO code to redirect to an output file. e.g. this directs output to file %temp%\output.txt:

set fnOut=%temp%\output.txt
>> "%fnOut%" echo command 1
command 1
>> "%fnOut%" echo command 2
command 2

Open in new window


After the user logs on, review the output file.
Ajoy RajanSenior IT AdministratorAuthor Commented:
This is the script:

@echo off
echo Do not close this window till copy of files finish:  Thank you ICT Team
xcopy "\\xxx.local\users\%username%\AppData\Google\chrome\Default\*.*" "%localappdata%\Google\Chrome\User Data\Default\" /q /s /e /i /y /c
echo %username% %date% %time% >> \\xxx.local\users\reports\Chrome.txt
exit

I am not sure that the script runs or not. It is applying the GPO but the script do not seem to run. where as when I run the script by copying to the startup folder of the user's roaming profile, it runs as soon as the user login.
NVITEnd-user supportCommented:
Try this...

@echo off
set fnOut=%temp%\output.txt
>> "%fnOut%" echo Do not close this window till copy of files finish:  Thank you ICT Team
echo Do not close this window till copy of files finish:  Thank you ICT Team
>> "%fnOut%" echo xcopy...
xcopy "\\xxx.local\users\%username%\AppData\Google\chrome\Default\*.*" "%localappdata%\Google\Chrome\User Data\Default\" /q /s /e /i /y /c
>> "%fnOut%" echo %username% %date% %time%...
echo %username% %date% %time% >> \\xxx.local\users\reports\Chrome.txt
exit

Open in new window


After the user logs on, review %temp%\output.txt
Ajoy RajanSenior IT AdministratorAuthor Commented:
The output script I removed the Do not close line and just tried with xcopy. The output.txt has xcopy… repeatedly. It just keeps going.
Ajoy RajanSenior IT AdministratorAuthor Commented:
do you have a VBScript to which I might be able to use for this?
NVITEnd-user supportCommented:
> The output.txt has xcopy… repeatedly

Please post the whole script. You can change and sensitive info if needed.
Ajoy RajanSenior IT AdministratorAuthor Commented:
The whole script is in my post above. That is all I am using for the script.

I need to make sure that the Chrome's default directory for every user is copied from the roaming profile into their local appdata. So that when we move the users to use chrome using the local appdata they do not find any difference.
NVITEnd-user supportCommented:
> The output.txt has xcopy… repeatedly

This confirms the batch file is running.

So the issue may be xcopy.

What about line 8? Is it creating Chrome.txt?
Ajoy RajanSenior IT AdministratorAuthor Commented:
no it does not. As it is not going to run till the xcopy command is finished.
NVITEnd-user supportCommented:
> The output.txt has xcopy… repeatedly. It just keeps going.

How can you be certain?

Maybe xcopy is never finishing for some reason.

Have user manually run that exact xcopy command in a CMD window.
What is the result?
Ajoy RajanSenior IT AdministratorAuthor Commented:
The xcopy command runs but I tried something. This may sound weird but, I ran the command in cmd and it worked fine. Then I converted the same command to batch file and it is not running the batch file.
NVITEnd-user supportCommented:
> Then I converted the same command to batch file and it is not running the batch file

Didn't you say in an earlier post the batch is running? Just the problem seems to be xcopy.

Are you now saying not the batch doesn't run at all?
Ajoy RajanSenior IT AdministratorAuthor Commented:
I have been working on SCCM pushing the xcopy command and testing it at this stage.
Ajoy RajanSenior IT AdministratorAuthor Commented:
I used PDQ deploy to push the script to machines and worked like a charm.

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
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
Windows Batch

From novice to tech pro — start learning today.