Powershell: A one line script to terminate all BizTalk suspended messages

Here is a quick powershell script which terminates all suspended messages on a local BizTalk Server host.

This script includes all service instances, you can however very easily modify the script for finer control to use any other different set of properties for each instance. For example if you included the condition ‘ServiceClass = 4’ as well you would be only terminating “messaging” service instances.

Here is the script.

Get-WmiObject MSBTS_ServiceInstance  -namespace 'root\MicrosoftBizTalkServer' -filter 'ServiceStatus = 4'  |`
%{Get-WmiObject MSBTS_ServiceInstance -namespace 'root\MicrosoftBizTalkServer' -filter "InstanceID = '$($_.InstanceID)'"} |`
%{ $_.Terminate()} |`
%{ Out-Null }

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: