MSBTS_SendPort.Name (propiedad) (WMI)
Contiene el nombre del puerto de envío.
La sintaxis se muestra en lenguaje neutro.
Sintaxis
string Name;
Comentarios
Esta propiedad es obligatoria para la creación de instancias. Esta propiedad solo se puede escribir en la creación de la instancia. Después de la creación de instancias, esta propiedad es de solo lectura.
Esta propiedad tiene un calificador Key . Junto con MgmtDbNameOverride y MgmtDbServerOverride, esta clave forma una clave compuesta para la clase .
La longitud máxima de esta propiedad es de 256 caracteres.
Esta propiedad ajusta la propiedad de Microsoft.BizTalk.ExplorerOM.SendPort.Name administrada.
Ejemplo
El siguiente ejemplo se tomó del archivo 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
El siguiente ejemplo se tomó del archivo 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
No se proporciona ningún ejemplo correspondiente a C#.
Requisitos
Header: declarado en BTSWMISchema2K.mof o en BTSWMISchemaXP.mof.
Espacio de nombres: incluido en \root\MicrosoftBizTalkServer.