biztalk custom adapter

PowerShell Script to Register Custom Adapters

Published on : Feb 8, 2022

Category : BizTalk Server

Sandro

Author

Registering a BizTalk Server custom adapter is easy, but most of the time is not very pleasant because it involves several manual steps. Also, because it is not a common or daily task, we tend to forget how to do certain actions, which forces us to search every time we need to do it.

In my case, I usually don’t remember how to start a command prompt in 64-bit.

How to install a custom adapter?

Usually, a custom adapter, not a WCF extension used by custom WCF-Adapters, provides a Windows Registry file (.reg). To register the adapter for it to appear on the BizTalk Server Administration Console, we need to:

  • Copy all the DLL’s to a directory on the BizTalk Server machines
  • Access the folder where the .reg file is and double-click on it
    • This step will register the adapter to run under 32-bit host instances
  • To make it available also for 64-bits, you need to:
    • Click Start
    • Type %windir%\SysWoW64\cmd.exe in the search box and press Enter
    • Run the same adapter registry (.reg) file from this command prompt

Now, if you open the BizTalk Administration Console and right-click on the console left tree, BizTalk Server Administration > BizTalk Group > Platform Settings > Adapters, in the Adapter combo-box , you will see the custom adapter that you have just registered.

Using PowerShell to register a custom adapter

To simplify the custom adapter registration process, I decided to create a simple PowerShell script to do the trick. Once again, in my case, this is to avoid searching how to run a command prompt in 64-bit every time I need to register a custom adapter.

This PowerShell script will ask you the directory and name of the Windows Registry file (.reg), and after validating its existence, it will ask you if you want to register to run under 32-bit or/and 64-bit host instances.

$questionResult = $windowsShell.popup("Do you want to install this adapter to run under 64-bit Host Instances?", 0,"64-bit Host Instances installation",4)

If ($questionResult -eq 6) {
# c:\windows\regedit.exe /S $regFilePath
reg import $regFilePath /reg:64
Write-Host "Adapter installed as 64-bit." -Fore DarkGreen
}

$questionResult = $windowsShell.popup("Do you want to install this adapter to run under 32-bit Host Instances?", 0,"32-bit Host Instances installation",4)

If ($questionResult -eq 6) {
# c:\Windows\syswow64\regedit /S $regFilePath
reg import $regFilePath /reg:32
Write-Host "Adapter installed as 32-bit." -Fore DarkGreen
}

Download

THIS POWERSHELL SCRIPT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

You can download the PowerShell Script to Register Custom Adapters from GitHub here: