WMI ScheduledJob does not run - Windows 7 64 bit

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I want to create a schedule task in C# that will run an exe.
Code as follows, being run an administrator :
<pre class="prettyprint Win32_ScheduledJobClass = new ManagementClass(@"Win32_ScheduledJob");

ManagementBaseObject createParameters = Win32_ScheduledJobClass.GetMethodParameters("Create");
createParameters["Command"] = mCommand;
createParameters["DaysOfMonth"] = daysOfMonth;
createParameters["DaysOfWeek"] = daysOfWeek;
createParameters["InteractWithDesktop"] = interactWithDesktop ;
createParameters["RunRepeatedly"] = mRunRepeatedly ;
createParameters["StartTime"] = formatString ;

Win32_ScheduledJobClass.InvokeMethod("Create", createParameters,null);[/code]
I get the Accepted return code.
I have tried the Command property inside " " as there is a space in the path ( Command exe on same machine as code that created the ScheduledJob ). I have run the at command in cmd and it is present and set with start time that I expected.
Is it because it is a 64 bit machine ?
Are any credentials required ?
Should there be an entry in the Event Log ?
Is there a wmi event that can be watched ?
The Task Scheduler service is running.

Many thanks
Tony




<br/>

<br/>

<br/>


View the full article
 
Back
Top