use wmi to schedule X number of second in the future

E

emebohw2

I understand how to use wmi to schedule a job in a general sort of way,
but how can you use it to schedule a job to run in say 1 minute from
the execution time of the script? Or even better, immediatlly, like in
unix you can use "at now <some command>" and the job would run just a
split second after execution. Is the same possible using wmi to control
the scheduler?
 
E

emebohw2

Alright, I found the ms site that defines the parameters you can pass
the wmi job scheduler stuff, but now I have a new problem. I am trying
to schedule a task on a remote machine that will execute a batch file
on another remote share (share is shared out to everyone) and I keep
getting access violations. Is this possible without 3rd party software?
Heres what I am doing:

'----script starts
strComputer = "REMOTE1"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")

Set objNewJob = objWMIService.Get("Win32_ScheduledJob")

errJobCreated = objNewJob.Create _
("\\server1\d$\mybat.bat", "********163300.000000-420", _
False, , ,True, JobID)
Wscript.Echo errJobCreated
'-----script ends
 

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