This project has moved and is read-only. For the latest updates, please go here.

{"Logon failure: unknown user name or bad password. (Exception from HRESULT: 0x8007052E)"}

May 22, 2009 at 8:24 AM

I get this error when I run the following code on  windows 2003 server. The code works fine on a windows vista machine.

            TaskService ts = new TaskService("\\buildserver");

            TaskFolder tf = ts.RootFolder;

            foreach (Task t in tf.Tasks)
                MessageBox.Show("Name : " + t.Name + ", Last Task Result : " + t.LastTaskResult + ", Last Run Date : " + t.LastRunTime);

I cannot get LastRunTime and LastTaksResult, but getting the next run time works. I have tried the code on the Windows

2003 server and connecting from it remotely. I have specified a username and password and that also didn't work. I am

trying to write a gui to manage windows scheduled task accross multiple servers.

Cheers Rudolph

May 26, 2009 at 4:29 PM

By default, the library tries to use the v2 library which only works on Vista and Server 2008. You may want to try forcing the v1 library through the TaskService constructor:

TaskService ts = new TaskService("\\buildserver", null, null, null, true);

Please reply and let us all know if that works.

Mar 3, 2010 at 11:32 AM


I've got the same exception when registering new Task.


Logon failure: unknown user name or bad password. (Exception from HRESULT: 0x8007052E)



TaskService ts = new TaskService();
TaskDefinition td = ts.NewTask();
				TaskLogonType.Password, null);



TaskService ts = new TaskService("\\buildserver", null, null, null, true);
Didn't help.

Do you have any suggestions how to fix this?


Mar 3, 2010 at 12:11 PM

Problem solved.

Appropriate password must be set for the specified User


May 23, 2013 at 10:52 AM

i too have the same issue, credentials which i have passed are correct but no joy.
Could you please tell me what do you mean by appropriate password?
Please help me.
May 23, 2013 at 3:12 PM
A valid username and password must be provided in both the TaskService constructor and in the RegisterTaskDefinition method.
Oct 24, 2013 at 1:23 AM
Hi All,

I'm developing a tool that needs to create a task in as part of it's functionality. I want to schedle the task using System account but don't want to ask user for any password. what is the solution?

Oct 28, 2013 at 3:44 PM
Use "SYSTEM" for the username and null for the password and set TaskLogonType to SystemAccount. There are a number of discussions about this if you search for SYSTEM.