The other day I was having an issue with our build server so I decided to write a script to reconfigure BizTalk on our build or development servers. My plan was to run this regularly on a scheduled basis to ensure our build servers were kept clean.
I thought id write a little about this as it may be useful to others. Note the script is aimed at a single machine hosting BizTalk 2006 R2 and SQL Server.
Before I started I exported the configuration of our BizTalk Group to a file and then amended the credentials etc.
The list of tasks I would perform to clean and reconfigure our server is as follows:
Task |
Description |
Delete log file |
When I run the BizTalk Configuration tool from the command line I will make it log to a file for troubleshooting any problems. Before I start the first clean up activity is to delete any old logs |
Stop the following services:
|
I stop any services which may want to access the BizTalk databases |
Restart the following services:
|
|
Remove the EDI BAM definitions |
When EDI is setup the BAM definitions for this feature are configured creating the usual BAM components. We need to remove these using BM.exe before we unconfigure BizTalk because unconfiguring the group will not remove the BAM Definitions |
Use the BizTalk Configuration Editor to unconfigure the group. |
|
Stop the WMI Service and any dependant services as advised by the BizTalk documentation |
|
Delete the backup of the SSO Key |
Note this is just for a development machine, you need to be careful about this on any real environment. I just delete the backup file here so I can recreate it when configuring the group |
Unregister and delete the SSNS application for BAM Alerts |
I will use NsControl.exe to do this |
Run a SQL Script to drop the BizTalk databases |
|
Delete the share and folder used by BAM Alerts |
These are not removed when the group is unconfigured so need to be done manually |
Start the following services:
|
Ensure any services which may be used while configuring BizTalk are started |
Run the BizTalk Configuration Editor passing in the file containing the desired configuration. |
To implement this I created a Visual Studio solution and wrote an MsBuild script and used some of the Microsoft.Sdc tasks. The below picture shows the files in this solution.
Its pretty simple and I will provide a link to the sample at the end of this post.
Some of the other ways I have extended this script since include:
- Using an MsBuild task to register some custom adapters
- Using an MsBuild task to register the WSE2 and Enterprise LOB adapters
- Using an MsBuild task to add adapter handlers
- Using the MsBuild configuration dictionary stuff I have blogged about in previous posts to configure the BizTalk Configuration xml file for different environments
The link to the sample for this post is: http://www.box.net/shared/t4k0m6ps5y