MSBTS_SendPort.Name 속성(WMI)
송신 포트의 이름을 포함합니다.
표시된 구문은 언어 중립적입니다.
구문
string Name;
설명
인스턴스를 만들려면 이 속성이 필요합니다. 이 속성은 인스턴스를 만들 때만 쓰기 가능한 상태가 됩니다. 인스턴스를 만든 후에 이 속성은 읽기 전용이 됩니다.
이 속성에는 키 한정자 가 있습니다. MgmtDbNameOverride 및 MgmtDbServerOverride와 함께 이 키는 클래스에 대한 복합 키를 형성합니다.
이 속성의 최대 길이는 256자입니다.
이 속성은 관리되는 Microsoft.BizTalk.ExplorerOM.SendPort.Name 속성을 래핑합니다.
예제
다음 예제는 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
다음 예제는 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
C# 샘플은 제공되지 않습니다.
요구 사항
헤더: BTSWMISchema2K.mof 또는 BTSWMISchemaXP.mof에 선언되어 있습니다.
네임스페이스: \root\MicrosoftBizTalkServer에 포함되어 있습니다.