Ravindar, Biztalk Developer and Administrator

Just another BizTalk blog

access Ports from Powershell

A user asked in the forums here how to access ports through wmi.

my sample solution to access ports is below

Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer catalog = new Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer();

foreach (Microsoft.BizTalk.ExplorerOM.Application application in catalog.Applications)

                foreach (Microsoft.BizTalk.ExplorerOM.ReceivePort recport in application.ReceivePorts)
                    foreach (Microsoft.BizTalk.ExplorerOM.ReceiveLocation recloc in recport.ReceiveLocations)


                foreach (Microsoft.BizTalk.ExplorerOM.SendPort sendport in application.SendPorts)


Also another user asked here wanted to unbound an orchestration completely programmatically. here is the solution

[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"

$MyApplication = $Catalog.Applications["TestApp"]
$orch = $MyApplication.orchestrations

foreach ($CurrentOrchestration in $orch)
    $CurrentOrchestration.Status = [Microsoft.BizTalk.ExplorerOM.OrchestrationStatus] "Enlisted"
    $CurrentOrchestration.Status = [Microsoft.BizTalk.ExplorerOM.OrchestrationStatus] "Unenlisted"
    foreach ($CurrentPort in $CurrentOrchestration.Ports)


January 9, 2015 - Posted by | Uncategorized

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: