This is the Timeout Seconds use to run this script.
Source Code:
<WriteActionModuleType ID="Microsoft.BizTalk.Library.EnableReceiveLocation.Task" Accessibility="Public" RunAs="Microsoft.BizTalk.ProbeAccount">
<Configuration>
<xsd:element name="TargetComputer" type="xsd:string"/>
<xsd:element name="ReceivePortName" type="xsd:string"/>
<xsd:element name="ReceiveLocationName" type="xsd:string"/>
<xsd:element name="TaskOption" type="xsd:string"/>
<xsd:element name="TimeoutSeconds" type="xsd:int"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="TimeoutSeconds" ParameterType="int" Selector="$Config/TimeoutSeconds$"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<WriteAction TypeID="Windows!Microsoft.Windows.ScriptWriteAction" ID="Script">
<ScriptName>Microsoft.BizTalk.Library.EnableReceiveLocation.vbs</ScriptName>
<Arguments>$Config/TargetComputer$ "$Config/ReceivePortName$" "$Config/ReceiveLocationName$" $Config/TaskOption$</Arguments>
<ScriptBody><Script>
'Copyright (c) Microsoft Corporation. All rights reserved.
'*******************************************************************************
' $ScriptName: "Enable/disable Receive Location" $
'
' Purpose - This script enable/disable a Receive Location.
'
' Parameters
' "TargetComputer" = the computer that we target this task
' "ReceivePortName" = the name of the receive port
' "ReceiveLocationName" = the name of the receive location
' "Option" = this is the task option (enable/disable)
'
' $File: Microsoft.BizTalk.Library.EnableReceiveLocation.vbs $
'
'*************************************************************************
Option Explicit
SetLocale("en-us")
Dim oArgs
Dim objInstSet, objInst, strQuery
Dim strReceivePortName, strReceiveLocationName, strTargetComputer, strNamespaceToUse, strQueryToUse
Dim strOption
Const EVENT_SOURCE = "Task enable or disable Receive Location"
Set oArgs = WScript.Arguments
if oArgs.Count < 4 Then
Wscript.Quit -1
End If
strTargetComputer = oArgs(0)
strReceivePortName = oArgs(1)
strReceiveLocationName = oArgs(2)
strOption = oArgs(3)
strNamespaceToUse = "\ROOT\MicrosoftBizTalkServer"
strQueryToUse = "SELECT * FROM MSBTS_ReceiveLocation WHERE ReceivePortName =""" & strReceivePortName & """AND Name =""" & strReceiveLocationName & """"
ExecActionOnReceiveLocation
Sub ExecActionOnReceiveLocation()
Dim strMessage
On Error Resume Next
Set objInstSet = GetWMICollection(strTargetComputer, strNamespaceToUse, strQueryToUse)
'Check for error condition before continuing.
If Err <> 0 Then
PrintWMIErrorThenExit Err.Description, Err.Number
End If
'If found, execute action, otherwise print error and end.
If objInstSet.Count > 0 then
For Each objInst in objInstSet
Select Case strOption
Case "1"
objInst.Enable
strMessage = "The Receive Location was successfully enabled."
Case "2"
objInst.Disable
strMessage = "The Receive Location was successfully disabled."
End Select
If Err <> 0 Then
PrintWMIErrorThenExit Err.Description, Err.Number
End If
WScript.Echo
Next
Else
WScript.Echo "No Receive Location was found matching that Name."
End If
End Sub
Function GetWMICollection(TargetComputerToUse, strNamespace, strQuery)
Dim WbemSrv, WbemObjectSet
Set WbemSrv = Getobject("winmgmts:{impersonationLevel=impersonate}!\\" & TargetComputerToUse & strNamespace)
Set WbemObjectSet = WbemSrv.ExecQuery(strQuery)
Set GetWMICollection = WbemObjectSet
End Function
'This subroutine deals with all errors using the WbemScripting object. Error descriptions
'are returned to the user by printing to the console.
Sub PrintWMIErrorThenExit(strErrDesc, nErrNum)
On Error Resume Next
Dim objWMIError : Set objWMIError = CreateObject("WbemScripting.SwbemLastError")
If ( TypeName(objWMIError) = "Empty" ) Then
WScript.Echo strErrDesc & " (HRESULT: " & Hex(nErrNum) & ")."
Else
WScript.Echo objWMIError.Description & "(HRESULT: " & Hex(nErrNum) & ")."
Set objWMIError = Nothing
End If
'bail out
WScript.Quit 0
End Sub
'=================================================================================
' Publish resulting performance data / Create events
'=================================================================================
Sub CreateEvent(strSource, lngEventID, lngEventType, strMsg, strSrcComputer)
CreateEventEx strSource, lngEventID, lngEventType, strMsg, strSrcComputer, True
End Sub
Sub CreateReportEvent(strSource, lngEventID, lngEventType, strMsg, strSrcComputer)
CreateEventEx strSource, lngEventID, lngEventType, strMsg, strSrcComputer, False
End Sub
Sub CreateEventEx(strSource, lngEventID, lngEventType, strMsg, strSrcComputer, blnIncScriptName)
Dim oAPI
Set oAPI = CreateObject("Mom.ScriptAPI")
Call oAPI.LogScriptEvent(strSource, lngEventID, lngEventType, strMsg)
End Sub