Scheduling Jobs using WMI

  • Thread starter Thread starter Ravi
  • Start date Start date
R

Ravi

Hi all,

I am trying to invoke an application on a remote server. I would want
that application to be interactive and so I am not using Win32_Process
to invoke the app. Instead, I am using Win32_ScheduledJob.Create method
to schedule the job. Here is my code:
strComputer = "Mars"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
JobID = "MailLocator"
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreate = objNewJob.Create _
("MailLocator.exe", "********154900.000000-420", _
, , ,True, JobId)

Now, I want the job to execute immediately after I create it. Something
similar to "at now <command>".

How can I do this using WMI?

Thanks
Ravi
 
Back
Top