Propriété MSBTS_SendPort.Name (WMI)
Contient le nom du port d'envoi.
La syntaxe présentée est indépendante de la langue.
Syntaxe
string Name;
Notes
Cette propriété est requise pour la création d'une instance. Cette propriété n’est accessible en écriture qu’au moment de instance création. Par la suite, elle est toujours en lecture seule.
Cette propriété a un qualificateur de clé . Avec MgmtDbNameOverride et MgmtDbServerOverride, cette clé forme une clé composée pour la classe .
La longueur maximale de cette propriété est de 256 caractères.
Cette propriété encapsule la propriété managed Microsoft.BizTalk.ExplorerOM.SendPort.Name .
Exemple
L'exemple suivant est issu du fichier SDK\Samples\Admin\WMI\Remove Send Port\VBScript\RemoveSendPort.vbs.
Sub RemoveSendPort()
'Get the command line arguments entered for the script
Dim objArgs: Set objArgs = WScript.Arguments
'error handling is done by explicity checking the err object rather than using
'the VB ON ERROR construct, so set to resume next on error.
On Error Resume Next
'Make sure the expected number of arguments were provided on the command line.
'if not, print usage text and exit.
If (objArgs.Count <> 1) Then
PrintUsage()
WScript.Quit 0
End If
Dim objInstSet, objInst, strQuery
Dim strSendPortName
strSendPortName = objArgs(0)
'set up a WMI query to acquire a list of send ports with the given Name key value.
'This should be a list of zero or one Send Ports.
strQuery = "SELECT * FROM MSBTS_SendPort WHERE Name =""" & strSendPortName & """"
Set objInstSet = GetObject("Winmgmts:!root\MicrosoftBizTalkServer").ExecQuery(strQuery)
'Check for error condition before continuing.
If Err <> 0 Then
PrintWMIErrorThenExit Err.Description, Err.Number
End If
'If Send Port found, Start it, otherwise print error and end.
If objInstSet.Count > 0 then
For Each objInst in objInstSet
'The send port must be unelisted first.
objInst.UnEnlist()
If Err <> 0 Then
PrintWMIErrorThenExit Err.Description, Err.Number
End If
WScript.Echo "The Send Port was successfully unenlisted."
'Now remove the send port
objInst.Delete_()
If Err <> 0 Then
PrintWMIErrorThenExit Err.Description, Err.Number
End If
WScript.Echo "The Send Port was successfully removed."
Next
Else
WScript.Echo "No Send Port was found matching that Name."
End If
End Sub
'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
L'exemple suivant est issu du fichier SDK\Samples\Admin\WMI\Start Send Port\VBScript\StartSendPort.vbs.
Sub StartSendPort()
'Get the command line arguments entered for the script
Dim objArgs: Set objArgs = WScript.Arguments
'error handling is done by explicity checking the err object rather than using
'the VB ON ERROR construct, so set to resume next on error.
On Error Resume Next
'Make sure the expected number of arguments were provided on the command line.
'if not, print usage text and exit.
If (objArgs.Count < 1) Or (objArgs.Count > 2) Then
PrintUsage()
WScript.Quit 0
End If
Dim objInstSet, objInst, strQuery
Dim strSendPortName, strPrimaryTransportAddress
strSendPortName = objArgs(0)
'Check if PTAddress is to be set
If (objArgs.Count = 2) Then
'PTAddress for these samples are being set reletive to install location
' NOTE: This is assuming that this is a FILE transport type
' and we want to update it with the current directory
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
'Check for error condition before continuing.
If Err <> 0 Then
PrintWMIErrorThenExit Err.Description, Err.Number
End If
strPrimaryTransportAddress = WshShell.CurrentDirectory & objArgs(1)
Else
strPrimaryTransportAddress = ""
End If
'set up a WMI query to acquire a list of send ports with the given Name key value.
'This should be a list of zero or one Send Ports.
strQuery = "SELECT * FROM MSBTS_SendPort WHERE Name =""" & strSendPortName & """"
Set objInstSet = GetObject("Winmgmts:!root\MicrosoftBizTalkServer").ExecQuery(strQuery)
'Check for error condition before continuing.
If Err <> 0 Then
PrintWMIErrorThenExit Err.Description, Err.Number
End If
'If Send Port found, Start it, otherwise print error and end.
If objInstSet.Count > 0 then
For Each objInst in objInstSet
'If the PTAddress is to be set, change it now
If "" <> strPrimaryTransportAddress Then
objInst.PTAddress = strPrimaryTransportAddress
If Err <> 0 Then
PrintWMIErrorThenExit Err.Description, Err.Number
End If
WScript.Echo "Primary Transport Address was set to:"
WScript.Echo strPrimaryTransportAddress
End If
'Now commit the change
objInst.Put_(1)
If Err <> 0 Then
PrintWMIErrorThenExit Err.Description, Err.Number
End If
WScript.Echo "Changes were successfully committed."
'Now start the send port
objInst.Start
If Err <> 0 Then
PrintWMIErrorThenExit Err.Description, Err.Number
End If
WScript.Echo "The Send Port was successfully started."
Next
Else
WScript.Echo "No Send Port was found matching that Name."
End If
End Sub
Aucun exemple n’est fourni pour C#.
Spécifications
En-tête : déclaré dans BTSWMISchema2K.mof ou BTSWMISchemaXP.mof.
Espace de noms : inclus dans \root\MicrosoftBizTalkServer.