as they say in Germany, the Eier-Liegende Voll-Milch-Sau :P
As you don't say how complex the script is, and what exactly you are trying to do (but I'll have a wild guess from the Object you are trying to create), we import Software Packages into the Repository, and build the deployment, repair and deinstall jobs using XML, for each package. Each package has an XML, which contains install, repair and de-install strings / commands, as well as any pre-requisites and "post" requisites that it needs.
The code is written in C#, whilst not as low-level as C++, it is alot easier when "fannying-around" with COM objects.
Cheers
Phil