Trying to automate the process of creating Send Handlers in BizTalk 2006? You may be trying to use the class MSBTS_SendHandler, as shown in the snippet of code below. However, the class to be used in BizTalk 2006 is now MSBTS_SendHandler2 as the old one does not support creation of multiple send handlers, a constraint in BizTalk 2004.


‘ Explicit declaration of variables
Option Explicit


‘ wbemChangeFlagEnum Setting
const UPDATE_ONLY = 1
const CREATE_ONLY = 2


‘ Retrieve the arguments passed
‘Dim objArgs: Set objArgs = WScript.Arguments


‘ Connects to local server WMI Provider BizTalk namespace
Dim objLocator : Set objLocator = Createobject (“wbemScripting.SWbemLocator”)
Dim objService : Set objService = objLocator.ConnectServer(“.”, “root/MicrosoftBizTalkServer”)


‘ Get WMI class MSBTS_ReceiveHandler
Dim objSendHandler : Set objSendHandler = objService.Get (“MSBTS_SendHandler“)


Dim objSH : Set objSH = objSendHandler.SpawnInstance_


objSH.AdapterName = “FILE”
objSH.HostName = “FILE_SendHost”


On Error Resume Next
‘ Create instance
objSH.Put_(CREATE_ONLY)
CheckWMIError
On Error Goto 0