On Win2003, Scheduler Does Not Execute Second Line of '*.B..

G

Guest

Guest
Archived from groups: microsoft.public.windows.server.general,microsoft.public.win2000.general (More info?)

Hello,

On Win2003, I intend to use the scheduler to execute a script
(Say test_script.bat) which contains the following 2 lines:

net use n: ... (Server,drive and password specified) > > log1
dir N: >> log2 (The command is actually an SAP script using the
drive, but this example keeps things simple and
also fails).

When I execute this script (As test_script.bat) through the
command line, everything works well. The 2 log files are
created or appended. Drive N: is successfully mapped.

However, when I execute the '*.bat. file through the
Windows scheduler, with the same userid, the following
happens:

(i) log1 is created or appended, stating that the
command executed successfully.
(ii) log2 is not created or appended
(iii) The scheduler log indicates that one statement
was executed, but that the script finished with an
exit code of '1'.

Even when I change the 'dir N: >> log2' to 'dir C:\temp >> log2',
log2 is not created when the job is executed through the
scheduler. Thus, the issue is not the mapping to N:.

I would greatly appreciate assistance with the following
questions:

(i) Why would both lines of the'*.bat' file execute successfully
from the command line, but only the first line execute when
running the script through the scheduler, using the same
userid?

(ii) What does an exit code of '1' mean for the Windows
scheduler?

(iii) Is there a way for me to increase the log level of the
Windows scheduler to capture more information?




Thanks,
BASIS Consultant
 
G

Guest

Guest
Archived from groups: microsoft.public.windows.server.general,microsoft.public.win2000.general (More info?)

Incorrect function called or unknown function called.

Scheduled Tasks|Advanced|View Log may provide some details. If the job
connects to another machine you may need to add the user/ group 'logon as
batch job' rights (server side). Control Panel|Admin Tools|Local Security
Policy\Local Policies\User Rights Assignments
"Log on as a batch job"

Remember that if it involves network resources to make sure the user account
has permissions to the resources and also use UNC paths as mapped drives
won't exist when no one is logged on.

code 1 is "Incorrect function called or unknown function called."

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

<basis_consultant@hotmail.com> wrote:
| Hello,
|
| On Win2003, I intend to use the scheduler to execute a script
| (Say test_script.bat) which contains the following 2 lines:
|
| net use n: ... (Server,drive and password specified) > > log1
| dir N: >> log2 (The command is actually an SAP script using the
| drive, but this example keeps things simple and
| also fails).
|
| When I execute this script (As test_script.bat) through the
| command line, everything works well. The 2 log files are
| created or appended. Drive N: is successfully mapped.
|
| However, when I execute the '*.bat. file through the
| Windows scheduler, with the same userid, the following
| happens:
|
| (i) log1 is created or appended, stating that the
| command executed successfully.
| (ii) log2 is not created or appended
| (iii) The scheduler log indicates that one statement
| was executed, but that the script finished with an
| exit code of '1'.
|
| Even when I change the 'dir N: >> log2' to 'dir C:\temp >> log2',
| log2 is not created when the job is executed through the
| scheduler. Thus, the issue is not the mapping to N:.
|
| I would greatly appreciate assistance with the following
| questions:
|
| (i) Why would both lines of the'*.bat' file execute successfully
| from the command line, but only the first line execute when
| running the script through the scheduler, using the same
| userid?
|
| (ii) What does an exit code of '1' mean for the Windows
| scheduler?
|
| (iii) Is there a way for me to increase the log level of the
| Windows scheduler to capture more information?
|
|
|
|
| Thanks,
| BASIS Consultant
|