COMException was Unhandled (93;8):Logon Type:

Sep 30, 2009 at 6:46 AM


I assume that the TaskService project is meant to be an example of how to use this Library so please correct me if I'm wrong before we go much further.

I have tried to run this example however this throws the above exception: TaskFolder Line 177 to line 180

     public Task RegisterTaskDefinition(string Path, TaskDefinition definition, TaskCreation createType, string UserId, string password, TaskLogonType LogonType, string sddl)
            if (v2Folder != null)
                return new Task(this.TaskService, v2Folder.RegisterTaskDefinition(Path, definition.v2Def, (int)createType, UserId, password, LogonType, sddl));


I'm running the project on Win7/VS2008 64bit.

Any assistance/pointers will be welcomed.


Sep 30, 2009 at 5:18 PM

Will you provide the parameters that are being used when calling this method?

Sep 30, 2009 at 9:25 PM

None whatsoever.

I set TestTaskService as the Startup Project, compiled and ran it as I believed it is a Winforms project.

I can't find ay documentation on what parameters are required.



Sep 30, 2009 at 10:45 PM

Can you confirm, while in the debugger, that the RegisterTaskDefinition method throwing the exception is being called from line 201 in Program.cs? Also, will you confirm that no task by the name "Test" exists in the root folder of the Task Scheduler and let me know if you have Adminstrator rights for the account you are in?

Sep 30, 2009 at 11:03 PM

1: Confirmed

2: Dunno what or where the root folder is.

3: Yes

The problem was fixed by:

         TaskDefinition td = ts.NewTask();
            td.Data = "Your data";
            td.Principal.UserId = "KATOOMBA\\Administrator";            <==== Line 103 in Program.cs | changing this fixed the issue.
            td.Principal.LogonType = TaskLogonType.InteractiveToken;
            td.RegistrationInfo.Author = "dahall";

Seems I missed/am missing the documentation somewhere.


Oct 1, 2009 at 5:51 AM

Thanks for your help. Fortunately there is not a problem with the base library, only with my test harness. An updated Program.cs in the TestTaskService project resolves the problems you experienced. You can find it in the source code drop 30818. I had hard coded my credentials. Now it will grab the current user's so it will always work.