如何使用PowerShell提供程序删除名称中包含斜杠的BizTalk接收端口?

时间:2014-05-30 12:48:26

标签: powershell biztalk biztalk-ps1-provider

如果名称包含斜杠,如何删除接收端口?

我的名字中有一个带斜杠的接收端口,例如:像... TestReceivePort / Service

当我尝试Remove-Item -Path "TestReceivePort/Service"时,我收到错误...

Remove-Item : Cannot find 
              path BTS:\Applications\TestApp\Receive Ports\TestReceivePort\Service

尝试-LiteralPath,尝试使用单引号

1 个答案:

答案 0 :(得分:1)

希望这会有所帮助:

[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
$rcvLocation =  $Catalog.ReceivePorts | Where {$_.Name = 'rcvLocation/withSlash'}
$Catalog.RemoveReceivePort($rcvLocation)
$Catalog.SaveChanges()