How To Use Existing Credential For Executable Task Created Via API - VisualCron - Forum

Community forum

ben.dixon
2018-07-09T13:24:53Z
I am using the VisualCron API in .NET to create a new Job on a remote VC. The job consists of two tasks, one executable task and one logging (write to file) task, and requires credentials in order to run successfully. I have attempted variations of the following but none of them seem to work:

myExecutionTask.ExecutionContext.UserName = "theLoginName"; // Should include the domain or not?
myExecutionTask.ExecutionContext.BeforeExecutionLogon = true; // I assume this must be true
myExecutionTask.ExecutionContext.BeforeExecutionLogonCredential = "b4302537-6a65-4f2b-97de-0133fa6f422a"; // I assume this should be the credential ID

The result of any/all of these settings is that the API successfully creates the job with the two tasks and the job appears to run successfully (as far as VC is concerned) but the expected output is not generated. If I inspect the tasks, I see there is no credential set. If I set the credential and run the task, everything works as expected: VC reports success and I get the expected output from the execution of the tasks.

Is there an example of using API to set the credential? This seems like possibly a bug but the docs around the expected string values for the UserName and BeforeExecutionLogonCredential aren't clear so I want to be sure I'm setting it up correctly.

Thanks.
Support
2018-07-10T11:58:09Z
You should use:

myExecutionTask.Execute.NetworkCredential = "b4302537-6a65-4f2b-97de-0133fa6f422a";

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ben.dixon
2018-07-10T13:06:17Z
Thanks Henrik. This has solved my problem.
Scroll to Top