Gokul's Blog


Leave a comment

Script to Terminate Suspended Orchestration Instances

To terminate the Suspended Instances, create a .vbs file and add the below code.

TerminateAllOrchs – This script will terminate all Orchestrations so please use caution.

Sub TerminateAllOrchs 
 
  Query = "SELECT * FROM MSBTS_ServiceInstance where ServiceClass = 1" 
 
  Set InstSet = GetObject("Winmgmts:!root\MicrosoftBizTalkServer").ExecQuery(Query) 
 
  For Each Inst In InstSet 
 
    Inst.Terminate 
 
  Next 
 
End Sub

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

To delete the Suspended Instances of a Particular Orchestration use the Query as follows:

Query = "SELECT * FROM MSBTS_ServiceInstance where ServiceClass = 1 and AssemblyName='<name>’"

With <name> being the Assembly name of the Orchestration .(Which can be got from the Right-Click properties of your BizTalk Project).

The above is taken from Stephen Thomas’s blog.

Microsoft Technet link: http://technet.microsoft.com/en-us/library/bb203857.aspx

This page has a detailed explanation of how to use WMI scripts to terminate instances, routing failure messages, etc.

Side Tip:

Create Receive Location by Code: Check this link. http://blogs.covarius.com/PermaLink,guid,fbb1654d-0033-4f19-b8df-84003cca517e.aspx

Create send Port by Code: http://www.winterdom.com/weblog/2004/10/20/CreatingPortsInBizTalkServer2004Programatically.aspx