Tick "Run whether user is logged in or not" Programmatically

Topics: Setup
Mar 15, 2016 at 12:52 PM
How do I activate this using this API, I was able to successfully create a working schedule but unable to activate this.

Image
Coordinator
Mar 15, 2016 at 2:48 PM
Use the TaskLogonType.S4U value when registering the task.
Marked as answer by dahall on 3/18/2016 at 10:00 AM
Mar 17, 2016 at 11:46 PM
Hi dahall, thanks for the info, but how do i do that, can you give me an example? Thanks, appreciate the help.
Coordinator
Mar 18, 2016 at 5:59 PM
Edited Mar 18, 2016 at 5:59 PM
ts.RootFolder.RegisterTaskDefinition("Test", td, TaskCreation.CreateOrUpdate,
   null, null, TaskLogonType.S4U, null);
Marked as answer by dahall on 3/18/2016 at 10:00 AM
Apr 5, 2016 at 2:59 AM
Thanks! Apologies for the late reply, it worked.
Apr 5, 2016 at 5:14 PM
Would this work in Task Scheduler version 1.0 as well ?
Coordinator
Apr 7, 2016 at 2:38 PM
You'd have to try. v1 was created so long before major part of the authentication mechanisms in the current Windows Server, I cannot predict its behavior.