I created a script using appcmd.exe to setup my FastCGI application in IIS. They work but I am unsure about a few details. Some of the options in the below commands have been shortened for clarity.
Some of the command details start with a slash and some with a dash. Which is the preferred style? Also, I am not clear on which ones require /commit and which do not. Note that I have a delete command so that I can run the script multiple times.
appcmd.exe delete vdir /vdir.name:"Default Web Site/pbcgi"
appcmd.exe add vdir /app.name:"Default Web Site/" /path:/pbcgi /physicalPath:"C:\TopwizWeb"
appcmd.exe set config /section:system.webServer/handlers /accessPolicy:Read,Script,Execute /commit:apphost
appcmd.exe clear config -section:system.webServer/handlers -"[name='TopwizWeb FastCGI']"
appcmd.exe set config -section:system.webServer/handlers /+"[name='TopwizWeb FastCGI', path='*.pbcgi']"
appcmd.exe clear config -section:system.webServer/fastCgi -"[fullPath='C:..\TopwizWeb.exe']"
appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='C:..\TopwizWeb.exe', maxInstances='4']" /commit:apphost

/commitdepends on in which configuration file you would like to see the settings to be applied. For most settings, they can be added to different locations/files, so/commitgives you an option to choose a specific file.