Firstly, your batch file is using mixed redirection. The first line uses >> to APPEND to the log file, but the others use > which will REPLACE the log file. So, at the moment the only thing you'll see in the batch file is the result of the last line! i.e.
Code:
echo %Date% %Time% > d:\email\mailback.log
Which will produce a log file ONLY containing:
So, you may find that the batch file is working, just that the log file implies it isn't.
Secondly, I would try to avoid using the mapped drive if you can. If you only have one file server hosting their home drives use the UNC path as this will remove the dependency on the drive being mapped at all.
So, instead of xcopy targetting "h:\email" target "\\servername\%username%\email".
Lastly, I don't see any value in running the script from the local PC (d:\mailback.bat). At the moment, you have a script in the GPO which checks for another script on the PC to run. That gives you an admin headache should you want to update the batch file on all those PCs.
So, instead, just have the mailback.bat in your GPO. Here's my edited version:
Code:
echo %Date% %Time% >> d:\email\mailback.log
xcopy d:\email\*.* \\yourservername\%username%\email /s /e /v /y /d /f >> d:\email\mailback.log
echo %Date% %Time% >> d:\email\mailback.log
JJ
[small][purple]
Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, or photo, or breakfast...and so on)[/small]