Here are some samples you can use to list, start/stop, enable/disable, enlist/unenlist and so on your Send Ports, Receive Ports, and Recieve Locations.
Note the path hierarchy. You must specify you application name. I’m using “BizTalk EDI Application” since anyone with EDI installed will have the same results.
Sample Script
cls
Add-PSSnapIn -Name BiztalkFactory.PowerShell.Extensions #NOTE: Must be in 32-bit version of Powershellto use this SnapIn
cd "Biztalk:\Applications\BizTalk EDI Application\Send Ports"
Get-ChildItem | ft -auto # or just type in "DIR", the "| ft -auto" avoids the Name being cut off with the elipse ...
Write-Host "`nSend Ports - List Completed"
Get-ChildItem |Where-Object { $_.Name -match 'ResendPort' } | Unenlist-SendPort
Get-ChildItem |Where-Object { $_.Name -match 'ResendPort' } | Start-SendPort
cd "Biztalk:\Applications\BizTalk EDI Application\Receive Ports"
Get-ChildItem | ft -auto # or just type in "DIR", the "| ft -auto" avoids the Name being cut off with the elipse ...
Write-Host "`nReceive Ports - List Completed"
cd "Biztalk:\Applications\BizTalk EDI Application\Receive Locations"
Get-ChildItem | ft -auto # or just type in "DIR", the "| ft -auto" avoids the Name being cut off with the elipse ...
Write-Host "`nReceive Ports - List Completed"
cd "Biztalk:\Applications\BizTalk EDI Application\Receive Locations"
Get-ChildItem |Where-Object { $_.Name -match 'ResendReceiveLocation' } | Disable-ReceiveLocation
Get-ChildItem |Where-Object { $_.Name -match 'ResendReceiveLocation' } | Enable-ReceiveLocation
Note: I didn't put any Write-Host to show when the ports were succesfully stopped or started, you could add that i you want it.
Output of running the above script
Path: BiztalkFactory.PowerShell.Extensions\BizTalk::Biztalk:\Applications\BizTalk EDI Application\Send Ports Name Status Application ---- ------ ----------- ResendPort Started BizTalk EDI Application Send Ports - List Completed Path: BiztalkFactory.PowerShell.Extensions\BizTalk::Biztalk:\Applications\BizTalk EDI Application\Receive Ports Name Application ---- ----------- BatchControlMessageRecvPort BizTalk EDI Application ResendReceivePort BizTalk EDI Application Receive Ports - List Completed Path: BiztalkFactory.PowerShell.Extensions\BizTalk::Biztalk:\Applications\BizTalk EDI Application\Receive Locations Name Enabled Application ---- ------- ----------- BatchControlMessageRecvLoc True BizTalk EDI Application ResendReceiveLocation True BizTalk EDI Application Receive Ports - List Completed PS BizTalk:\Applications\BizTalk EDI Application\Receive Locations>
When you install the Powershell Extensions for BizTalk, there is a readme.txt file created ("d:\Program Files (x86)\Microsoft BizTalk Server 2016\SDK\Utilities\PowerShell\readme.txt") that will show you all the cmdlets that are available (such as Start-SendPort, Unenlist-SendPort, etc...)