Aha...
I have the K2 Knowledge base article on it :-) ... and it's attached!
I'm sure you could write an application to invoke those commands.... the challenging part would be coping with any errors in the deployment.
Martin
Also... why do my posts have no formatting... hmmmm (see previous post)