Problem with xcopy in Scheduled Task

  • Thread starter Thread starter jgfa9
  • Start date Start date
J

jgfa9

Hi,
I've already saw messages related to this problem but none solved mine
:
I have a batch file which source code is :

xcopy /Y /S C:\source.txt \\my_server\dest.txt

If I run this script manually (double-click), it works : the file is
copied.

If I try to make it run with the Windows Scheduled Task, it fails the
both ways I tried :
- if I specifY "System" in the "run as" field in the task property
window ("NT AUTHORITY\SYSTEM" is then written automatically), the task
seems to run but the "last result" indicates "0x4" and the file is not
copied.
- if I specify "Administrator" ("INTRANET\ADMINISTRATOR" put
automatically) (Administrator has full rights, I am logged as
Administrator on the local machine AND on the remote one), I have the
"could not start" status and obviously the file is not copied.

What am I missing ? Can somebody help me ?

Thanks in advance.
 
jgfa9 said:
Hi,
I've already saw messages related to this problem but none solved mine
:
I have a batch file which source code is :

xcopy /Y /S C:\source.txt \\my_server\dest.txt

If I run this script manually (double-click), it works : the file is
copied.

If I try to make it run with the Windows Scheduled Task, it fails the
both ways I tried :
- if I specifY "System" in the "run as" field in the task property
window ("NT AUTHORITY\SYSTEM" is then written automatically), the task
seems to run but the "last result" indicates "0x4" and the file is not
copied.
- if I specify "Administrator" ("INTRANET\ADMINISTRATOR" put
automatically) (Administrator has full rights, I am logged as
Administrator on the local machine AND on the remote one), I have the
"could not start" status and obviously the file is not copied.

What am I missing ? Can somebody help me ?

Thanks in advance.

You cannot run this job under the System account because
the System account has no access to networked resources.

You should not run it under the Administrator account
either because the job will pop into the foreground during
interactive Administrator sessions. There are also problems
with changing passwords.

You should create a dedicated Schedule account with
suitable access to networked resources. Furthermore you
must allow this dedicated account to log on as a batch job.
Run gpedit.msc, then follow this path:
Local Computer Policy / Computer Configuration / Windows Settings /
Security Settings / Local Policy / User Rights / Logon as a batch job.
 
It works ! Thanks a lot !!!
You cannot run this job under the System account because
the System account has no access to networked resources.

You should not run it under the Administrator account
either because the job will pop into the foreground during
interactive Administrator sessions. There are also problems
with changing passwords.

You should create a dedicated Schedule account with
suitable access to networked resources. Furthermore you
must allow this dedicated account to log on as a batch job.
Run gpedit.msc, then follow this path:
Local Computer Policy / Computer Configuration / Windows Settings /
Security Settings / Local Policy / User Rights / Logon as a batch job.
 
Back
Top