Closed bulldogamd closed 5 years ago
You're right. I forgot to put the 0
value in for the second param. I'll correct.
Thanks!
Have you gotten RunEx to actually work on a remote device? I've been using Run successfully but on certain devices Task Scheduler gets in the Queued Status when you attempt to Run. Known issue with Task Scheduler.
So i attempt to run this and it does NOT start
using (TaskService ts = new TaskService(ComputerName, creds.UserName, creds.Domain, creds.Password, forceV1))
RunningTask runtask = tsk.RunEx(TaskRunFlags.IgnoreConstraints, 0, "Domain\User");
This doesn't start either
RunningTask runtask = tsk.RunEx(0, 0, "Domain\User");
However I can get it to run by running SCHTASKS where /RUN /I is ignoring constraints.
Thanks for your support.
I just connected to a remote Windows Server 2019 using
new TaskService("ServerName", "user", "DOMAIN", "pwd", false);
then successfully ran
var task = ts.AddTask("Test", QuickTriggerType.Daily, "notepad.exe", "$(Arg0)", "DOMAIN\\user", "pwd", TaskLogonType.InteractiveToken, null);
task.RunEx(TaskRunFlags.IgnoreConstraints, 0, null, @"C:\cmd.txt");
My guess is that you have a permissions problem on the remote computer. Please see the Wiki on security for what you may need to allow (firewall settings, account security and running services) on the remote computer.
Have you been able to resolve your issue by adjusting the configuration of the connected systems?
This example doesn't even work
var runningTask = tsk.RunEx(TaskRunFlags.IgnoreConstraints, "DOMAIN\User", "info");
The second parm is expecting an integer.
Help Topic: https://dahall.github.io/TaskScheduler/html/M_Microsoft_Win32_TaskScheduler_Task_RunEx.htm