PHP, Windows

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:

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!


View Comments