Windows – Task Scheduler (run whether user is logged on or not)

batch-fileprivilegesscheduled-taskswindows

I'm having a problem with scheduling a task in Windows 7
I m creating a task which is mapped to a bat file to execute,
here is my .bat file :

cd "C:\soft\" 
Start excel "" "AD Auto Run.xlsm"

its working automaticaly and manually when the option (radio button) "Run only when the user is logged on" is selected.

but the automatic/manual RUN is not working when the option (radio button) "Run whether user logged on or not" is selected.

Best Answer

I resolved the issue by performing these steps:

Create the empty Desktop folders at the below path:

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

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.

Create a file and save it with .cmd extension. The .cmd file should contain below cmd:

cscript.exe “<path to .vbs file>”

In the scheduler, give the path as follows:

• Program/script: filename (.cmd filename)

• Start in(optional): file path (path to .cmd file)