Problems using GP to run batch file to be run when User Logson to workstation.

ServerX - windows server 2016, DNS server, dhcp server, group policy server
ServerZ - windows server 2016, IIS server, WSUS, HyperV, contains folder with specific data.

Using ServerX, Group Policy, setting up logon for workstations to use a batch file in \\ServerZ\updatews.bat

updatews.bat contains:
xcopy \\ServerZ\specialfiles$\*.* C:\myfiles

However, nothing happens.

I have checked the share on \\ServerZ\specialfiles$ is in place and has everyone as permission to read.
I have checked there are files to copy from \\ServerZ\specialfiles$
The folder C:\myfiles does exist on the workstation

The workstation are running Win7 Pro 32bit.

Any help appreciated.
AIGSNetwork AdministratorAsked:
Who is Participating?
"Using ServerX, Group Policy, setting up logon for workstations to use a batch" - make sure that this GPO and with it the script has applied. Use

gpresult /h %temp%\results.html & %temp%\results.html
to retrieve and look at the settings.
Shaun VermaakTechnical Specialist/DeveloperCommented:
And this command runs fine manually?
xcopy \\ServerZ\specialfiles$\*.* C:\myfiles

Open in new window

as the top line in your batch file you should add:

if not exist "C:\myfiles\" mkdir C:\myfiles
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Shaun VermaakTechnical Specialist/DeveloperCommented:
Using ServerX, Group Policy, setting up logon for workstations to use a batch file in \\ServerZ\updatews.bat
Is it startup or logon script? With logon script users will probably not have access to C:\myfiles
Why shouldn't they? Folders created on c: will by default be writable to anyone - no matter who creates them.
Shaun VermaakTechnical Specialist/DeveloperCommented:
You do not know that for sure, it could have been changed from defaulr
I am still waiting for answer to #a42424542
AIGSNetwork AdministratorAuthor Commented:
I have tested it manually - works ok.
All permission appear to be ok.
The folder concerned does exist.
In the end i removed the Logon scripts completely from GP and found a setting in GP that allows you to copy files as part of the GP, it works fie, no issues.
Thanks for you help and guidance.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.