Wez Furlong

Browse archives
Conference Presentations
Subscribe. (circulation 772)
Comments. (circulation 1)

Search powered by Google

I am Wez Furlong, Director of Engineering at Message Systems. My team is responsible for the fastest MTA on Earth.

I'm also a PHP Core developer and OpenSource contributor, residing in Maryland with Juliette, Xander and Lily. (read more)

30th January 2005 @ 22:05 EDT

The other product of last night was another win32 only extension, this time for manipulating scheduled tasks. Why do you need an extension? The reason is that Microsoft chose to expose the "mstask" API as non-automation compatible COM APIs; that means that you can't simply use the PHP COM extension (which is really "PHP-OLE") to work with it.

The win32scheduler extension provides 5 functions:

  • win32_scheduler_enum_tasks() - returns an array containing the names of the scheduled tasks that are present on the system.
  • win32_scheduler_run(string taskname) - requests that the system run a given task immediately. It does not wait for the task to complete.
  • win32_scheduler_get_task_info(string taskname) - returns information about a given task.
  • win32_scheduler_set_task_info(string taskname, array info [, bool new]) - updates or creates a new task.
  • win32_scheduler_delete_task(string taskname) - deletes a named task.

It's fairly self explanatory, although the details for the task info are a little weird. I'll document those for PHP at a later date, but if you're interested in working with it now, you'd do well to read the MSDN docs on the Task Scheduler; the structures and unions docs will help you to figure out the task info format. If you want to create a task, you'll find it helpful to var_dump() the info returned from an existing task; the set_task_info() function uses the same data format. Top tip: you need to supply a "Password" field and set it to the password for the user account you set in "RunAs".

This extension should also be showing up on the PHP 5 PECL snaps page in the next couple of hours.

Enjoy!

Post a comment
23rd February 2005 @ 02:48 EDT

"I'll document those for PHP at a later date."

How later is "a later date"?

by ullrichr@gmail.com in .
23rd February 2005 @ 02:53 EDT

You can read about it on MSDN, and look at what comes back for existing tasks.

I'm too busy to do it now, otherwise I would have done it already :)

24th March 2005 @ 10:52 EDT

Hi,

any chance to have a similar extension working with php4.3.x?

Thank you :)

by inuyaksa@geocities.com in .
28th August 2005 @ 10:14 EDT

If you want a more advanced scheduler to run your php scripts, you should use VisualCron. You can connect to the VisualCron server remotely. http://www.visualcron.com

by spam@enigma.se in .
21st April 2006 @ 07:01 EDT

I' m seriously in need of using win32scheduler extention in php .. how do i set a job of trigger type DAILY ,MONTHLY . etc.

can you please suggest any manuals regarding this topic. I tried MSDN help. but the syntax creates warnings "parameter mismatch error " : 0x80070057

Plz help me out . It' s urgent

by Ajith in .
Post a comment