Task Scheduler Problem - Run whether user is logged on or not is not working

蹲街弑〆低调 提交于 2021-02-19 03:36:06

问题


I have a batch file which in turn calls VB Script. The task of the VBScript contains a macro whose job is to login into the Oracle db, run few queries, fetch the output in Excel sheet and then it performs other functions.

The script is running fine in the scheduler when using the "Run only when user is logged in" option but it doesn't run when "Run whether user logged in or not" option is selected.

I tried all the options suggested here in previous posts but none of them worked.


回答1:


I resolved the above issue by performing below steps :

  1. Create the empty Desktop folders at the below path :

C:\Windows\System32\config\systemprofile\Desktop C:\Windows\SysWOW64\config\systemprofile\Desktop

  1. Make sure user has “log on as batch job” permission.

To enable this please follow below steps :
a) Go to the Start menu.
b) Type secpol.msc. and press Enter.
c) The Local Security Policy manager opens.
d) Go to Security Settings - Local Policies - User Rights Assignment node.
e) Double click Log on as a batch job on the right side.
f) Click Add User or Group.
g) Select the user.
h) Click OK.

  1. Create a file and save it with .cmd extension. The .cmd file should contain below cmd :
    cscript.exe “”

  2. In the scheduler, give the path as follows :
    • Program/script: filename (.cmd filename)
    • Start in(optional): file path (path to .cmd file)



来源:https://stackoverflow.com/questions/54516837/task-scheduler-problem-run-whether-user-is-logged-on-or-not-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!