Feb 11, 2010 at 2:30 PM
Edited Feb 12, 2010 at 4:10 AM
I'm trying to create a task with 'RunOnlyIfLoggedOn' property set to False.
But while setting this property, it is throwing me an exception as "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."
I'm using following code-
Dim taskDefinition As TaskDefinition = taskService.NewTask()
taskDefinition.Data = ""
taskDefinition.Principal.UserId = String.Concat(Environment.UserDomainName, "\", Environment.UserName)
taskDefinition.Principal.LogonType = TaskLogonType.InteractiveToken
taskDefinition.RegistrationInfo.Author = "Pavan"
taskDefinition.RegistrationInfo.Description = ""
taskDefinition.Settings.RunOnlyIfLoggedOn = False
For the last statement it throws "NotV2SupportedException" exception...
Can you please help me to solve this problem?