Avatar of Keith McElroy
Keith McElroy
 asked on

Task Scheduler does not run properly when the Run whether user is logged on or not is selected.

Microsoft Task Schedule does not work propertly when configured to "run whether user is logged on or not".  How do I properly configure a scheduled task to run when not logged in?

The problem happens even if I am logged in.  Therefore, it seems like a flaw in the Task Scheduler that just checking the  "run whether user is logged on or not" causes the problem no matter whether I am logged in or not.

The Task runs a bat file that calls a vbs file on a network drive which in turn automates populating a Word document.




MicrosoftVB ScriptNetworking* Windows Task Scheduler

Avatar of undefined
Last Comment
Keith McElroy

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
David Sankovsky

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Éric Moreau

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Keith McElroy

ASKER
Both responses have things for me to check out.  I shall work on this now and advise today or early tomorrow and will answer the questions.  The UNC seems like the most evident shortcoming of my efforts, but I really need to work through these.  Thank you very much.  I would be dead in the water without EE.


Keith McElroy

ASKER
I am attempting to answer the questions.  I did a lot of testing just now.
Two observations:
1.   "Run whether user is logged in or not" button selected is the one thing that adversely effects the outcome.
When this is not selected and the other option is selected, all operates correctly.
2.  When the "Run whether user is logged in or not" button is selected, the bat file runs the script and Microsoft Word is open in the taskmgr but not on screen.

Here is the detail I observed.  Apologies if I missed anything.  I'm trying to be thorough.


Test #1a Run manually with the "Run whether user is logged in or not" button selected:  Fail
Test #1b Same test but with "Run only when user is logged in" is selected: Success

Test #2a Run BAT file from CMD prompt:  Success
Test #2b Same test with output of test line added:  Success

BAT file contents including the ECHO
START CMD /C "ECHO My Popup Message && PAUSE"
wscript \\EG2W12VFILE01\BUDGETAUTOMATION\FY2022-23\run_automation.vbs 

Open in new window

Other Settings
Action: Start a progrem c:\Users\budgetautomation\Documents\automation.bat
Conditions
Stop if the computer ceases to be idle
Start the task only if the computer in on AC power
Stop if the computer switches to battery power
Allow task to be run on demand
Stop the task if it runs longer than 4 hours
If the running task does not end when requested, force it to stop

Test #3 - Run based on trigger
Nothing happens on screen but the taskmgr shows the script and Microsoft Word.
They show 0% CPU and some memory

The History tab show evidence of it running
There is a log file populated by the .vbs script.  It does not show being opened.


Keith McElroy

ASKER
If the task is already running, then the following rule applies:
Stop the existing Instance
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Keith McElroy

ASKER
I am now testing one more way:
"Run whether user is logged in or not" checked
Wake up computer to run checked

I logged off, then logged back on after the target time passed.
It appeared to be running.  I will test again a few times to see if that solves.

Both your questions, comments helped a lot.  The UNC was totally off my radar, did not even think of that.