列出所有应用程序,编排(如果有),为BizTalk 2010发送端口和接收端口?

时间:2011-06-29 16:19:47

标签: biztalk biztalk-2010

我需要列出所有应用程序,编排(如果有的话),为BizTalk 2010发送端口和接收端口。我正在尝试编写一个sql查询并获得许多重复项。任何人都可以帮助我吗?

SELECT
     APP.nvcName 
    ,APP.nvcName as [Application]
    ,A.nvcName AssemblyName
    ,O.nvcFullName OrchestrationFullName
    ,O.nvcName Orchestration
    ,'Send Port' as [PortType]
    ,S.nvcName as [PortName]
    ,S.bTwoWay as [SendType]
    ,'' --S.nvcName [ReceiveLocation]
    ,Adp.Name [AdapterType]
    ,RP.FullyQualifiedName [ReceivePipeline]
    ,SP.FullyQualifiedName [SendPipeline]
    ,S.nvcEncryptionCert [EncryptionCert]
FROM dbo.bts_application as APP
LEFT OUTER JOIN dbo.bts_sendport as S ON APP.nID = S.nApplicationID
LEFT OUTER JOIN  dbo.bts_sendport_transport as ST ON S.nID = ST.nSendPortID
LEFT OUTER JOIN  dbo.bts_assembly as A on A.nApplicationId = APP.nId
LEFT OUTER JOIN  dbo.bts_orchestration as O ON O.nAssemblyID = A.nId
LEFT OUTER JOIN  dbo.bts_orchestration_port AS OP ON OP.nOrchestrationID = O.nID
LEFT OUTER JOIN  dbo.bts_orchestration_port_binding as OPB ON PB.nOrcPortID = OP.nID --and OPB.nSendPortID = S.nID
LEFT OUTER JOIN  dbo.adm_Adapter as Adp ON ST.nTransportTypeId = Adp.Id
LEFT OUTER JOIN  dbo.bts_pipeline as RP on RP.Id = S.nReceivePipelineId
LEFT OUTER JOIN  dbo.bts_pipeline as SP on SP.Id = S.nSendPipelineId
WHERE S.nApplicationID is not null AND Adp.Name IS NOT NULL

3 个答案:

答案 0 :(得分:5)

直接使用底层SQL通常比使用BizTalkCatalogExplorer类更难以正确(并且不受支持)。

MSDN有一个很棒的Powershell脚本,它使用http://msdn.microsoft.com/en-us/library/dd257590(v=bts.70).aspx提供的BizTalkCatalogExplorer。除了实际的发送/接收端口之外,开箱即用它将显示您提到的所有内容(然后是一些内容)。

要获取发送端口的详细信息,您可以执行以下操作(它是基于上面链接的示例的PowerShell):

#=== Make sure the ExplorerOM assembly is loaded ===#
[void] [System.reflection.Assembly]::LoadWithPartialName("Microsoft.BizTalk.ExplorerOM")
#=== Connect to the BizTalk Management database ===#
$Catalog = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
$Catalog.ConnectionString = "SERVER=.;DATABASE=BizTalkMgmtDb;Integrated Security=SSPI"
foreach($port in $catalog.SendPorts)
{
    Write-Host $port.Name
    Write-Host "`tSendPipeline: "$port.SendPipeline.FullName
    if($port.IsTwoWay)
    {
        Write-Host "`tReceivePipeline: "$port.ReceivePipeline.FullName
    }
    Write-Host "`tPrimaryTransportType: "$port.PrimaryTransport.TransportType.Name
    Write-Host "`tPrimaryTransportAddress: "$port.PrimaryTransport.Address
    Write-Host "`tPrimaryTransportTypeData: "$port.PrimaryTransport.TransportTypeData
    # $port.PrimaryTransport <--uncomment to see all of the properties of $port.PrimaryTransport
}

请注意,$port.PrimaryTransport.TransportTypeData的结果将是一个XML代码段,其中包含对传输类型自定义的属性。您可以在该XML内找到您的密码字段。你必须解析它。当我在本地运行测试时,它实际上也打印出了密码,所以小心如何使用它。

答案 1 :(得分:3)

您可以使用ExplorerOM dll并使用公开的API来获取您所获得的信息。

http://msdn.microsoft.com/en-us/library/microsoft.biztalk.explorerom(v=bts.20).aspx

答案 2 :(得分:0)

您可以使用powershell列出所有应用程序,编排,接收和发送端口状态

# Get BizTalk Application Information

$applications = $BizTalkOM.Applications



# Display BizTalk Application Information

Write-Host "`nBizTalk Applications ("$applications.Count")" -fore DarkGray



Foreach ($application in $applications) {

    if ($application.Status -eq "Started") {

        Write-Host $application.Name "- " -NoNewline

        Write-Host $application.Status -fore Green

    }

    elseif ($application.Status -eq "Stopped") {

        Write-Host $application.Name "- " -NoNewline

        Write-Host $application.Status -fore Red

    }

    else {

        Write-Host $application.Name "- " -NoNewline

        Write-Host $application.Status -fore DarkYellow

    }

}
$trackingRecPorts = get-wmiobject MSBTS_ReceivePort -namespace 'root\MicrosoftBizTalkServer' | Where-Object {$_.Tracking -gt 0 }


$orchs = Get-WmiObject MSBTS_Orchestration -namespace 'root\MicrosoftBizTalkServer' | Where-Object {$_.OrchestrationStatus -ne 4 }