Tag Archive: Deployment

Nothing quite beats a totally scripted BizTalk installation. It might not be a one click install (unless you’re using advanced tools such as the BizTalk Deployment framework) seeing as there are quite a few screens to get through in the BizTalk msi import/install wizards, but you sure can make it a brainless task.

Some common tasks you might want to script are creation of hosts/host instances, addings send/receive handlers, configuring IIS etc…. You have a few options here such as using the WMI framework to carry out these commands in either a VBScript or a Batch file. You can then add this script file as a BizTalk resource and set it’s file type to either be a pre or post processing script. Think of a pre-processing script as a script that runs prior to your BizTalk install and a post-processing script as one that runs after your BizTalk install.

What you will notice is that the scripts execute when you import your MSI (whether it’s the first install or whether you’re overwriting an existing application), when you install the MSI, during a rollback of an import or install, and even when you uninstall the application. It is possible for you to restrict your script to only execute code selectively based on the current execution stage of the install, or to even implement different behavior based on the execution stage.

Microsoft allows you to query the execution stage (what they refer to as deployment state) from within your script through the use of environment variables (see http://msdn.microsoft.com/en-us/library/aa546763(v=bts.20).aspx). The values of the BTAD_ChangeRequestAction, and the BTAD_InstallMode environment variables can be used to uniquely identify the execution stage (the linked article also mentions the BTAD_HostClass environment variable but you really only need the first two to uniquely identify the execution stage).

The below screenshot is an example query within a VBScript script that is used to ensure that the code contained in the If…Then statement will only execute if the MSI is currently being installed, the code will not be executed for imports/rollbacks/uninstalls.

The below screenshot is an example query within a Batch file that is used to go to the Create block in the script if the MSI is currently being imported without an overwrite flag.