How to Run a Winbatch Job from a Scheduler
Keywords: scheduler privileges
Question:
Why can I run a script successfully on my PC (Win95/16-bit) using the following: u:\qt\winbatch\qt_daily.wbtbut when I try to run it from a job scheduler from the application as follows:
Application:
c:\program files\winbatch\system\winbatch.exeParameters:
u:\qt\winbatch\qt_daily.wbtDirectory:
c:\program files\winbatchI get a "1902: WinExec 2:File not found" error on the following line:Run ('C:\Program Files\Microsoft Office\Office\MSACCESS.EXE', 'C:\MYDOCU~1\OTTO_QT.MDB')Note: I have WinBatch 97DAnswer:
The U: in there leads me to believe a netwrok drive is involved.Stuff running from a scheduler service usually runs under a system account. System accounts do not have network privileges so it cannot access U:.
In addition the system account is running as a different user with different path variables, different environments and all sorts of differences. It is NOT running in the context of the logged on user.
Related Issue
Question:
I am developing a script which installs various software on our workstations. After installing NT Service pack 5 the workstation reboots and recalls my batch file starting at a flag from the scheduler service after 2 minutes. I wont go into why I need the scheduler service but I do. At this point WntAddDrive fails. Yet if I manually start my batch file again with the flag parameter it works. I have tried many times to get this to work without success.The error codes are:
Wil extender error: 499 Unrecognised network error #1299 (also had #1312) Winbatch 23.99g Wil Version 2.8GBTAny ideas ? I am trying to connect with administrator name and password specified.Answer:
The scheduler is probably starting the process in the "system" context and not the user context. The system context, if set to interact with the GUI, cannot make connections with network shares, if my memory is correct, unless you set up a null session share. When you activate the application manually, you are starting it in the user context, where different rules applyThe system account does not even have authority to start looking at trying to make a network connection.
Maybe do a wntRunAsUser first to bestow the required authority on the user. The system account should already have all the permissions it need to do a wntRunAsuser.
Article ID: W14245Filename: Run a Winbatch Job from a Scheduler.txt