Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

Created Unassigned: Exception: the name provided is not a properly formed account name for v.2.5.0 [12255]

$
0
0
The exception has apperad on RegisterTaskDefinition method in version 2.5.0 (in 2.4.2 all was oK):

_"The name provided is not a properly formed account name"_


```C#
private const string taskName = "MyCustomsPrintingServiceStarter";



public void Run(string installDir)
{
using (var taskService = new TaskService())
{
var task = taskService.FindTask(taskName);
if (task == null)
{
string pathToApplicationExeFile = GetPathToApplicationExeFile(installDir);

var definition = taskService.NewTask();
definition.Principal.RunLevel = TaskRunLevel.Highest;
definition.Triggers.AddNew(TaskTriggerType.Logon);
definition.Actions.Add(new ExecAction(pathToApplicationExeFile, workingDirectory: Path.GetDirectoryName(pathToApplicationExeFile)));
definition.Settings.DisallowStartIfOnBatteries = false;
definition.Settings.StopIfGoingOnBatteries = false;
definition.Settings.ExecutionTimeLimit = TimeSpan.Zero;
task = taskService.RootFolder.RegisterTaskDefinition(
taskName, definition, TaskCreation.Create, "Everyone", LogonType: TaskLogonType.Group);
}
task.Run();
}
}
```

Viewing all articles
Browse latest Browse all 2206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>