I need to list all Applications, orchestrations if any, send ports and receive ports for BizTalk 2010. I am trying to write a sql query and getting many duplicates. Can anyone help me?
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 NO开发者_如何转开发T NULL
Working directly with the underlying SQL is generally more difficult to get right (and unsupported) than working with something like the BizTalkCatalogExplorer class.
MSDN has a great Powershell script that uses BizTalkCatalogExplorer available at http://msdn.microsoft.com/en-us/library/dd257590(v=bts.70).aspx. Out of the box it will show you everything you mentioned (and then some), except for the actual send/receive ports.
To get the send ports' details, you can do something like this (it's powershell, based on the sample linked to above):
#=== 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
}
Notice that the result of $port.PrimaryTransport.TransportTypeData
will be an XML snippet that contains properties custom to the transport type. It's inside of that XML that you will find your password fields. You'll have to parse it. When I ran this locally to test it out, it actually printed out the passwords too, so be careful how you use this.
You could use the ExplorerOM dll and use the API that's exposed to get the information you're after.
http://msdn.microsoft.com/en-us/library/microsoft.biztalk.explorerom(v=bts.20).aspx
You could use the powershell for list all applications ,orchestrations, receive and send ports status
# 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 }
精彩评论