2

I have some simple scripts that have been in use on a windows 7 pc for years. I've migrated them to a windows 10 pc and they don't work. I have been pouring over posts related to issues like this and am still no closer to a solution.

At first I thought there was something complicated going on, partially because there are many posts that indicate a variety of fixes. But now it appears that this is a general problem. Here is the simple test to see the issue.

create a basic windows 10 x64 task scheduler task, set it to run "run whether user is logged in or not", and have the action be to execute notepad.exe. I have not found any windows 10 pc that this will work on.

What's odd is that the task will say "running" forever, and notepad.exe appears in the task manager list. But notepad or whatever has been called will never "appear".

As soon as I switch it over to run when the user is logged on it works fine. The success or failure of the tast is not dependent on whether the task is executed via a trigger or manually.

Summary of what I've tried based on suggestions in other's posts:

[1] set the action to run a bat file, where the bat file contains the call to the exe [2] make sure these folders exist: C:\Windows\System32\config\systemprofile\Desktop C:\Windows\SysWOW64\config\systemprofile\Desktop [3] if attempting to run a 32 bit program, include path to cmd like C:\windowns\Syswow64\cmd.exe /C [4] setting to run with highest rights has no impact [5] domain or local users makes no difference [6] users running are either domain or local admins according to #5

After reading https://serverfault.com/questions/251733/task-scheduler-runs-as-hidden-how-to-make-it-visible I am wondering if task scheduler now makes any ui that is normally presented by the running action invisible if "run whether user is logged in or not" is switched on. Is this all that it is?

  • Pretty disappointing you got downvoted for this issue. Thank you for asking it as I have run into the same problem and I'm not a sysadmin expert. – cyclingLinguist Oct 19 '21 at 14:25

2 Answers2

3

What you describe is perfectly logical.

The "run a task whether the user is logged in or not" simply makes the task being run as SYSTEM user, rather than your own user to ensure that the task will run.

Given that you are not the SYSTEM user, the program will never appear to you, but it will still run.

LPChip
  • 61,264
  • Yes it is logical that the app doesn't appear when run in this mode. – meridian Feb 25 '20 at 17:44
  • Also, keep in mind that the SYSTEM user will not have your network shares, and no access to network resources, so if your script depends or runs on the network, it will not work either. – LPChip Feb 25 '20 at 17:45
  • But the main problem that I wrote about remains unresolved. The process runs, eating 25% cpu, but never completes. If I run it as the use it completes. This is the main issue. I am wondering if the issue is related to another thing that seems odd to me on this pc - there are only two user accounts offered at login, the current user's account which I am testing with, and another admin level account. The start menu does not offer switch user; it only shows my login and the other admin level account. – meridian Feb 25 '20 at 17:49
  • Same thing if I log out - there is no "other user" option, there is only my account and the other admin account listed. I don't see this on other windows 10 pcs that I use at different orgs. I wonder if the other admin has it set up to only allow the two users, and that somehow is messing up the ability of task scheduler to run a task as "system"? – meridian Feb 25 '20 at 17:49
  • Good tip, but this routine doesn't rely on network assets. – meridian Feb 25 '20 at 18:17
  • To better demonstrate the problem I wrote an msaccess program that on startup logs the time in a table and closes after 5 seconds. If run via task manager with "run whether user is logged in or not" = true, it never creates that record. If false, it pops up, adds the record, and closed after 5 sec. – meridian Feb 25 '20 at 19:34
2

The applications that I was attempting to initiate via scheduled tasks were Office applications. It turns out that Microsoft has essentially switched off the ability to run Office applications using a System type account. They must run under a regular user profile. As far as I understand it now, this is the reason that the old tasks completely fail when the "run a task whether the user is logged in or not" switch is turned on. I didn't mention Microsoft Office in the original post because I didn't think it was relevant, but it appears to be the critical factor.

  • Ah yeah, had you written that, I could've mentioned that... Glad you figured it out anyway. Also, one thing I mistaken in the past with Task Scheduler: if a task starts but within a second stops, it will go from running to finished, but the GUI of Task Scheduler is not refreshed. If you refresh the GUI, it will then change from running to finished. – LPChip Feb 26 '20 at 18:01
  • Yep in this case it would have been useful if I'd been more specific. I had clues, because other tasks were executing as expected, but the bell didn't ring. I did notice that issue about the GUI not refreshing a while ago. Before that it was a puzzle why some tasks seemed to keep going, when it was clear they were completed. Thanks for your help with this! – meridian Feb 26 '20 at 22:37