I have been having lots of difficulty automating the setup of a Web application and configuring IIS appropriately with the Application Pool Identity. I am doing this in a Web a
seems you can do this a little more directly now
appcmd set apppool junkapp /processmodel.password:junkpassword