So the first thing I'd like to check are the Receive Locations and the Send Ports. I want to create this in a script so I can run this at-will. There are a few ways to do this: NotePad being the most basic, or we could download the PowerShell ISE. But my favorite is SAPIEN PowerShell Studio. I'm still trying to figure out why Microsoft hasn't tightly integrated this kind of functionality to Visual Studio.
So back to the scenario. The object to use in both cases is the Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Reflection.Assembly]::loadwithPartialName("Microsoft.BizTalk.ExplorerOM") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## - Force 32-bit mode, BizTalk.ExplorerOM does NOT support 64-bit mode | |
if ($env:Processor_Architecture -ne "x86") | |
{ | |
write-warning "Running x86 PowerShell..." | |
if ($myInvocation.Line) | |
{ | |
&"$env:WINDIR\syswow64\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line | |
} | |
else | |
{ | |
&"$env:WINDIR\syswow64\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args | |
} | |
exit $lastexitcode | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Catalog = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer | |
$Catalog.ConnectionString = "SERVER=xxxxx;DATABASE=BizTalkMgmtDb;Integrated Security=SSPI" | |
foreach($port in $catalog.SendPorts) | |
{ | |
$portname = $port.name | |
$portapplication = $port.application.name | |
$portstatus = $port.status | |
Write-Host "Name: $portname App: $portapplication Status: $portstatus" | |
} |
Receive Locations are nested one level deeper than Send Ports, otherwise they are essentially the same process.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach($port in $catalog.ReceivePorts) | |
{ | |
foreach ($location in $port.ReceiveLocations) | |
{ | |
$rxlocation = $port.ReceiveLocations | |
$locationname = $location.name | |
$locationapplication = $port.application.name | |
$locationstatus = $location.Enable | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach($application in $catalog.Applications) | |
{ | |
foreach ($orchestration in $application.Orchestrations) | |
{ | |
$AppName = $application.Name | |
$OrchName = $orchestration.FullName | |
$OrchApp = $orchestration.Application | |
$OrchHost = $orchestration.Host | |
$OrchStatus = $orchestration.Status | |
} | |
} |
Part 3 will cover Host Instances.
No comments:
Post a Comment