I’ve been working in the past weeks to setup a completely new BizTalk 2016 environments for a client, and I found myself in a situation where I will need to create the hosts, host instances and adapter for all environments (DEV, TEST, UAT, PROD). These tasks are very time consuming and having to do it over and over for four times will be really boring.
To help me with this tasks, I did a quick search on the internet and I found an article written by Sandro Pereira at https://blog.sandro-pereira.com/2017/07/27/powershell-biztalk-host-instances-adapter-handlers-best-practices/ that explains how to do exactly what I wanted.
Most of the work was done by him, so I just needed to adjust the scripts to my particular scenarios.
But one thing that is missing in that paper is how to install and configure the powershell extension, so after doing some more research I found that the installation of BizTalk 2016 already contains that extension and you just need to register it in powershell to use it.
The details to do the installation are in the readme.txt file at [BizTalk Install Folder]\SDK\Utilities\PowerShell, but I’m going to describe them here as well.
Powershell Installation Steps:
- Open a command prompt as an administrator
- Change directory to the folder containing the binaries – \SDK\Utilities\PowerShell under the base install location
- Run the following command to install/register the dlls
- %windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe .\BizTalkFactory.PowerShell.Extensions.dll
- Open a powershell console as admin in x86 mode and set the execution policy as remote-signed:
- Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
- Add the PS snap-in using the usual approach as below:
- Add-PSSnapin -Name BizTalkFactory.Powershell.Extensions
After executing these steps you will be able to execute the following cmdlets in powershell, which comes quite handy for repetitive tasks:
This will help me setting my personal powershell libraries to accelerate the installation of new environments for my clients, which will save money to them and time for me.