Last week I faced a challenge that seemed simple at first: manually synchronizing two BizTalk Server environments. What looked straightforward quickly turned into a nightmare—many routine tasks we rely on either failed or timed out, including exporting the application MSI. I ultimately had to use “non-conventional” strategies to work around these limitations and get the job done.
Of course, this didn’t work on the first try—it was a lot of trial and error. But having to push it through forced me to write several scripts, which I’ll be sharing here on my blog.
📝 One-Minute Brief
This is a PowerShell script that calls BTSTask command (handles spaces, captures output, and checks exit code) in order to export a list of all resources opf the application to an XML files.
The first PowerShell script I generated was a way to get a list of assemblies – BizTalk assemblies and non-BizTalk assemblies – that were associated with the applications. Of course, my first approach was to use the built-in tools in BizTalk Server, primarily BTSTask.exe.
Here is a short part of the script:
# Run and show output in console
& $btstask 'ListApp' "/ApplicationName:$app" "/ResourceSpec:$spec"
if ($LASTEXITCODE -ne 0) { throw "BTSTask failed with exit code $LASTEXITCODE" }
This PowerShell script will then generate an XML file with a list of all resources belonging to that application:
<?xml version="1.0" encoding="utf-16"?>
<ResourceSpec xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ApplicationName="Northwind" xmlns="http://schemas.microsoft.com/BizTalk/ApplicationDeployment/ResourceSpec/2004/12">
<Resources>
<Resource Type="System.BizTalk:BizTalkAssembly" Luid="Northwind.BusinessSolution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c2613f7a837e4390" />
<Resource Type="System.BizTalk:BizTalkAssembly" Luid="Northwind.BusinessSolution.Maps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c2613f7a837e4390" />
<Resource Type="System.BizTalk:BizTalkBinding" Luid="Application/Northwind" />
</Resources>
</ResourceSpec>
However, despite being a good idea, it didn’t work in my scenario, since BTSTask.exe behaved exactly like the Administration Console and ran into the same limitations. But still a nice script.
Download
THIS POWERSHELL SCRIPT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
You can download the PowerShell Script used from GitHub here:
Hope you find this helpful! If you enjoyed the content or found it useful, and wish to support our efforts to create more, you can contribute to purchasing a Star Wars Lego set for my son!