I am trying to programmatically create a scheduled task that is based on a network connection event.
I am working from a XML export from a working task. Everything seems to be OK except I get variants on the following error when I call the RegisterTaskDefinitionMethod:
(11,365):Subscription:<QueryList><Query Id="0" Path="Microsoft - Windows - NetworkProfile / Operational"><Select Path="Microsoft - Windows - NetworkProfile / Operational">*[System[Provider[@Name='Microsoft-Windows-NetworkProfile'] and EventID=10000]]</Select></Query></QueryList>
Data = {System.Collections.ListDictionaryInternal}
HResult = -2147009896
I get variants on this error regardless of how I format the XML string. I can try the > and < format. I can try the actual symbols > <, etc. But basically the same error.
The query string is directly from a working task export to XML. If I change my program to update the XML I exported and go through the Microsoft.Win32.TaskScheduler namespace and simply import the updated XML, the task is created successfully.
I am working from a XML export from a working task. Everything seems to be OK except I get variants on the following error when I call the RegisterTaskDefinitionMethod:
(11,365):Subscription:<QueryList><Query Id="0" Path="Microsoft - Windows - NetworkProfile / Operational"><Select Path="Microsoft - Windows - NetworkProfile / Operational">*[System[Provider[@Name='Microsoft-Windows-NetworkProfile'] and EventID=10000]]</Select></Query></QueryList>
Data = {System.Collections.ListDictionaryInternal}
HResult = -2147009896
I get variants on this error regardless of how I format the XML string. I can try the > and < format. I can try the actual symbols > <, etc. But basically the same error.
The query string is directly from a working task export to XML. If I change my program to update the XML I exported and go through the Microsoft.Win32.TaskScheduler namespace and simply import the updated XML, the task is created successfully.