How to update the URI (or part of it) on BizTalk Server Send Ports with PowerShell

Published on : Jan 11, 2021

Category : BizTalk Server



When you deploy a new BizTalk Server solution to a different environment and if, for some reason, you don’t use or cannot use CI/CD (Continuous integration and continuous delivery):

  • Your environment is too small to justify using CI/CD
  • The client doesn’t provide access to Visual Studio Team Services (VSTS)
  • Don’t like to use BTDF (Deployment Framework for BizTalk)
  • Not using custom tools like BizTalk Bindings Exporter tool

Then one of the most common tasks you need to do is to change all the URI from all the ports, Receive Ports and Send Ports, from the binding files.

Of course, you can do it in many different ways, for example:

  • Before import to the new environment, open Notepad or any other editor, and manually replace all the Inbound and  Transport URL’s
  • Import AS IS and on the Administration Console, manually change these parameters
  • Script this process

This is not always a quick and easy job. Luckily for us, these tasks can be automated, leading them to become simpler, faster, and avoid fewer errors.

The script that I will be showing you can be very useful, for example, in scenarios that during the lifecycle of existing applications, one system got updated or migrated to a different version or server (or both), and we need to update the URI or part of it on a range of the Send Ports according to the new configuration/specification.

PowerShell script overview

With this PowerShell sample, we will be able to set or update the URI (address) or part of the URI on a list of BizTalk Server Send Ports deployed in your BizTalk Server environment.

foreach($SendPort in $catalog.SendPorts)
    # In this case ...
        [string] $address = $SendPort.PrimaryTransport.Address

            $address = $address.Replace("mssql://.","mssql://BTS2020LAB01")
            $address = $address.Replace("C:\","D:\")
        $SendPort.PrimaryTransport.Address = $address

This script was tested in:

  • BizTalk Server 2020
  • BizTalk Server 2016



You can access and download the full PowerShell script from GitHub here: Update URI on BizTalk Server Send Ports with PowerShell