How to Terminate Suspended (not resumable) Routing Failure Report Instances with PowerShell

How to Terminate Suspended (not resumable) Routing Failure Report Instances with PowerShell

One of the annoying thing with working with Direct Bound Ports in Orchestrations, in especially, MessageBox direct bound ports that allow us to easily implement decouple publish-subscribe design patterns, is that you may get a situation in which you get a lot of Routing Failure Report Instances in the state Suspended (not resumable).

Terminate Suspended (not resumable): BizTalk Group by Service name Routing Failure Report

The error-handling properties facility allows us to automated handling of messaging failures as an alternative to the traditional (now default) behavior of placing failed messages in the Suspended queue. This automated handling routes an error message to any subscribing routing destination, such as a send port or orchestration. The error message is a clone of the original message with all previously promoted properties now demoted and with selected properties related to the specific messaging failure promoted to the message context.

Normally the easy way to implement this is to create a Send Port with the following filter:

  • ErrorReport.ErrorType = “FailedMessage”

Nevertheless, because we are using an orchestration with Direct Bound Ports, the orchestration will receive a PersistenceException that you can handle inside our business flow, however, is also create a Routing Failure Report Instance in the state Suspended (not resumable) without any ErrorReport property promoted

Terminate Suspended (not resumable): BizTalk Routing Failure Report Property Promotions

So, we cannot easily automate this kind of instances.

An alternative solution to automate this task is, inside the Error Handler, invoke a helper class library that deletes all these instances once they occur in controlled fashion way:

using (PowerShell PowerShellInstance = PowerShell.Create())
    StringBuilder pscript = new StringBuilder();
    pscript.AppendLine(@"[STRING]$SQLInstance = get-wmiobject MSBTS_GroupSetting -namespace rootMicrosoftBizTalkServer | select-object -expand MgmtDbServerName");
    pscript.AppendLine(@"[STRING]$BizTalkManagementDb = get-wmiobject MSBTS_GroupSetting -namespace rootMicrosoftBizTalkServer | select-object -expand MgmtDbName");
    pscript.AppendLine(@"[STRING]$BizTalkGroup = ""$SQLInstance"" + "":"" + ""$BizTalkManagementDb""");
    pscript.AppendLine(@"[ARRAY]$suspendedMessages = get-wmiobject MSBTS_ServiceInstance -namespace 'rootMicrosoftBizTalkServer' -filter '(ServiceStatus=32 and ServiceClass=64 and ServiceName like ""<name_of_our_orchestration>"")'");
    pscript.AppendLine(@"foreach ($msgSuspended in $suspendedMessages){");


How to check terminate Suspended (not resumable) Routing Failure Report Instances with PowerShell

Using PowerShell is a good option to delete all of this kind of messages, you can send a report and delete or just simply delete it. Windows PowerShell is a Windows command-line shell designed especially for system administrators and can be used by BizTalk administrators to help them in automating repetitive tasks or tasks that are time-consuming to perform manually.

Because was controlling the error inside the main orchestration I don’t have the need of additional report, so this is a simple script will allow you to delete all Routing Failure Report Instances suspended with the state Suspended (not resumable) from your BizTalk Server environment:

#Get all Suspended (not resumable) Routing Failure Report Instances
[ARRAY]$suspendedMessages = get-wmiobject MSBTS_ServiceInstance -namespace 'rootMicrosoftBizTalkServer' -filter '(ServiceStatus=32 and ServiceClass=64)'
foreach ($msgSuspended in $suspendedMessages)


Terminate Suspended (not resumable) Routing Failure Report Instances PowerShellTerminate Suspended (not resumable) Routing Failure Report Instances PowerShell (2 KB)
Microsoft | TechNet Gallery

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community. View all posts by Sandro Pereira