I've created several extension to stsadm which you can download from here: http://stsadm.blogspot.com/. The downloadable code provides numerous examples of how to programmatically manipulate tasks common during initial deployments (some are useful beyond the initial deployment but most are going to be used when trying to script your deployment as I've done).