.BAT file from Scheduled tasks

G

Geir Holmavatn

Hi,

I need to copy some file from a workstation to a fileserver with a scheduled
task. I have created a task, running as administrator with the correct
password. The task executes a .bat file with only an xcopy command.

The task runs correctly w/o any problems when run from Rightclick Task / Run
with the normal user logged in.

However it does not run correctly at the scheduled time when the normal user
is logged in.

What am I missing, anything special when running .bat files from the
scheduler?

Thanks for hints

Geir
 
H

Haggis

Geir Holmavatn said:
Hi,

I need to copy some file from a workstation to a fileserver with a
scheduled
task. I have created a task, running as administrator with the correct
password. The task executes a .bat file with only an xcopy command.

The task runs correctly w/o any problems when run from Rightclick Task /
Run
with the normal user logged in.

However it does not run correctly at the scheduled time when the normal
user
is logged in.

What am I missing, anything special when running .bat files from the
scheduler?

Thanks for hints

Geir

the "normal" user may not have rights to do what the batch is trying
....check your scheduler..look at the "run as" section , make sure the user
stated there has the correct permissions to do the batch
 
G

Geir Holmavatn

the "normal" user may not have rights to do what the batch is trying
...check your scheduler..look at the "run as" section , make sure the user
stated there has the correct permissions to do the batch

1. The task is assigned to the administrator user in the 'Run as' property

2. When the normal user is logged in he can right-click the task and Run
it without problems and the files are copied.

It is this user who is logged in to the workstration at the moment when the
task should run. The scheduled task manager list the task as run at the
correct moment, but no files are actually copied.

Comments?

Geir
 
P

Pegasus \(MVP\)

Geir Holmavatn said:
1. The task is assigned to the administrator user in the 'Run as' property

2. When the normal user is logged in he can right-click the task and Run
it without problems and the files are copied.

It is this user who is logged in to the workstration at the moment when the
task should run. The scheduled task manager list the task as run at the
correct moment, but no files are actually copied.

Comments?

Geir

Give yourself a pair of eyes by modifying your batch file like so:

@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
xcopy.exe /.. /.. /.. 1>>c:\test.log 2>>&1
echo ErrorLevel of xcopy.exe=%ErrorLevel% >> c:\test.log
echo %date% %time% End of task >> c:\test.log

When you examine the log file then all will become clear!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

scheduled tasks not starting 2
Scheduled Tasks 2
Scheduled tasks and shutdown.exe 10
Task To Wake The PC? 1
Scheduled Tasks 10
0xc000013a 2
MS Scheduled Task 11
scheduled task 1

Top