Search code examples
biztalkbiztalk-2010biztalk-ps1-provider

How can you programatically create a receive location?


How can you programatically create a BizTalk receive location in PowerShell?

And extending the question ... receive ports and send ports

I've been using the BizTalk PowerShell provider, but unfortunately its New-Item method doesn't support these artefacts.


Solution

  • You can use explorerOM

    [void] [System.reflection.Assembly]::LoadWithPartialName("Microsoft.BizTalk.ExplorerOM")
    $server = "."
    $connectionString = "SERVER=" + $server + ";DATABASE=BizTalkMgmtDb;Integrated Security=SSPI"
    $Catalog = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
    $Catalog.ConnectionString = $connectionString
    

    You will have to add a new Application using "AddNewApplication"

    $app = $Catalog.AddNewApplication()
    $rcvPort = $app.AddNewReceivePort(0)
    $rcvLocation = $rcvPort.AddNewReceiveLocation()
    

    Define properties for the receive port and location.

    Good Luck.