Windows Powershell is the (not so) new command and scripting language from Microsoft. One of Powershell’s biggest features is the ability to leverage the power of the .NET framework directly from the command line. I am finding myself drawn to using Powershell more and more in many different scenarios, especially when I comes to automating deployment tasks.
BizTalk deployments are commonly made up of many different tasks spanning beyond just building, importing and installing a BizTalk solution. Often there are many pre and post build tasks which are required to complete the job. I have on occasion been involved in deployments which would have been simplified through automation with Powershell scripts.
In this series of posts I plan to post some of the scripts which I have written which can be reused or used as a guide to simplify common deployment tasks.
- Script 1 stops all running BizTalk applications (fully) and stops all host instances: BTSStopAllAppsAndHostInstance.ps1
- Script 2 starts all running BizTalk applications (fully) and starts all host instances:BTSStartAllAppsAndHostInstance.ps1
So what are contained within these scripts?
These scripts have been written for use against BizTalk Server 2009, and as such retrieve the BizTalk Server 2009 installation path from the windows registry. For control of the BizTalk Server applications, the Microsoft.BizTalk.Explorer.OM assemblies are used, while for the BizTalk host instances the Get-Service Powershell commandlet is used.
For more information I suggest reading up more about what I have done here using the following links:
- Windows Powershell on Technet: http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx
- Microsoft.BizTalk.ExplorerOM on MSDN: http://msdn.microsoft.com/en-us/library/microsoft.biztalk.explorerom%28BTS.10%29.aspx