Scheduling Jobs using WMI


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
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top