I am trying to define task with the following options as seen in task scheduler GUI:
"When running the task, use the following user account:" some_domain\my_user
"Run whether user is logged on or not": Ticked
"Do not store password. [...]": Unticked
some_domain\my_user
is a real Active Directory user and it has administrator privileges on the machine where the task is supposed to run - however, it is not a "local user" on this machine.
https://filestore.community.support.microsoft.com/api/images/be37bf2e-32eb-403a-b595-eec4e17f2212
I am able to enter all these details and create the task (when using the GUI to select the user I actually cannot find it in the list of users - it's not a local user - but I still can enter it manually). When I'm asked for password I provide it and the task is created (when I enter wrong password it doesn't get created).
However after creating the task the summary now shows "When running the task, use the following user account:" my_user
, i.e. some_domain\
prefix is gone.
And then when I try to run the task or it's triggered automatically it fails and I'm given error code 2147943726 which appears to mean "unknown user name or bad password".
I speculate that something responsible for getting credentials at runtime is trying to find user "my_user" instead of "some_domain\my_user" and fails.
The solutions I got from here: https://stackoverflow.com/questions/44348330/task-scheduler-failed-to-start-additional-data-error-value-2147943726 or here: https://stackoverflow.com/questions/13965997/powershell-set-a-scheduled-task-to-run-when-user-isnt-logged-in don't appear to work.