This project has moved. For the latest updates, please go here.

Error when running V1 - Unable to establish existence of the account specified

Topics: Errors
Nov 23, 2015 at 9:41 PM
Edited Nov 23, 2015 at 9:46 PM
Hello, i get this error when trying to create a scheduled task remotely on windows xp:

Unable to establish existence of the account specified

Seems to work perfectly on Win 7 devices..

Code:

using (TaskService ts = new TaskService(device.DeviceIp, "myuser", ".", "mypass",true))

(net 2.0)

This seems to state that i need to use V1:

https://support.microsoft.com/en-us/kb/2027483

But i was under the impression that stating true at the end of my code forced this?

Thanks
Nov 25, 2015 at 1:30 PM
Edited Nov 25, 2015 at 1:42 PM
I just tried using SCHTASKS and the task created correctly. When i use this wrapper i noticed that the task gets created on the remote device but fails to run. If i open the task in task manager and re enter the password then the task will run.

Here is the string that works with schtasks:

SCHTASKS /Create /S 10.160.8.58 ABC /U user /P pass /RU user /RP pass /SC HOURLY /TN doc /TR notepad

and here is the c# code for the actual task creation:
   TaskDefinition td = ts.NewTask();
                                            td.RegistrationInfo.Description =
                                                "Runs the deploycheck.exe";
                                            td.Principal.LogonType = TaskLogonType.InteractiveTokenOrPassword;
                                           
                                            td.Actions.Add(new ExecAction(program, origArguments, @"c:\temp\"));

                                            Task task = ts.RootFolder.RegisterTaskDefinition(taskName, td,
                                                TaskCreation.Create, "user", "pass",
                                                TaskLogonType.Password, null);
Thanks
Coordinator
Nov 25, 2015 at 4:31 PM
Use true for the last parameter in the TaskService constructor if and only if you know that the target server is WS2003 or XP, otherwise, use false.

Try this:
TaskService ts = new TaskService("10.160.8.58", "user", "userDomain", "pass", false);
TaskDefinition td = ts.NewTask();
td.RegistrationInfo.Description = "Runs the deploycheck.exe";
td.Actions.Add(program, origArguments, @"c:\temp\");
Task task = ts.RootFolder.RegisterTaskDefinition(taskName, td, TaskCreation.Create, "user", "pass", TaskLogonType.Password, null);
Marked as answer by dahall on 12/7/2015 at 2:31 PM