In a new post today Alex Netkachov steps through how he added the PHP scripting engine to his metabase scriptMaps on an IIS 5.1 web server:
I spent a few days on investigating how to modify IIS metabase from script. What I need is to add PHP engine to IIS programmatically during installing PHP. [...] The metabase object can be enumerated and each item of the enumeration can be enumerated to. The elements of this hierarchy represent folders you can see in IIS management console.
He builds out the ScriptMaps functionality (a recursive "walk" function) and another function to add the PHP scripting engine onto that (addPhpIsapi). A word of warning from Alex, though:
This code now is the part of Jamp installer. But because this functionality is dangerous, this code is not run during default installer and it recommended to backup the metabase before running it.