Hello,
I am working on using the TSMW setting up some tasks that use the 'run only if logged on' Task Scheduler 2.0 feature, and I have been running into problems.
I keep getting errors to the effect of 'Task Scheduler 2.0 (1.2) does not support setting this property. You must use an InteractiveToken in order to have the task run in the current user session.' The problem though is that I think I am setting a token correctly.
I dug into the source code (taskscheduler-98194) and I found that the error message is generated when the code attempts to set the Tasks.RunOnlyIfLoggedOn property. It looks like the error is generated if the v2Settings are NOT null. I would think that this should check for null, but I don't know the code base or object's internal logic. I found it very difficult to get the code compiling because of all the 3rd party add ins, or I would have just fixed it myself.
My question is: Is this an error I have found? If it is not, what is the correct way to set an interactive logon token?
I have a full write up posted on Stack Overflow with code samples, if that helps:
http://stackoverflow.com/questions/43599271/how-to-set-run-only-if-logged-in-and-run-as-with-taskscheduler-in-c
I am working on using the TSMW setting up some tasks that use the 'run only if logged on' Task Scheduler 2.0 feature, and I have been running into problems.
I keep getting errors to the effect of 'Task Scheduler 2.0 (1.2) does not support setting this property. You must use an InteractiveToken in order to have the task run in the current user session.' The problem though is that I think I am setting a token correctly.
I dug into the source code (taskscheduler-98194) and I found that the error message is generated when the code attempts to set the Tasks.RunOnlyIfLoggedOn property. It looks like the error is generated if the v2Settings are NOT null. I would think that this should check for null, but I don't know the code base or object's internal logic. I found it very difficult to get the code compiling because of all the 3rd party add ins, or I would have just fixed it myself.
My question is: Is this an error I have found? If it is not, what is the correct way to set an interactive logon token?
I have a full write up posted on Stack Overflow with code samples, if that helps:
http://stackoverflow.com/questions/43599271/how-to-set-run-only-if-logged-in-and-run-as-with-taskscheduler-in-c