如果名称包含斜杠,如何删除接收端口?
我的名字中有一个带斜杠的接收端口,例如:像... TestReceivePort / Service
当我尝试Remove-Item -Path "TestReceivePort/Service"
时,我收到错误...
Remove-Item : Cannot find
path BTS:\Applications\TestApp\Receive Ports\TestReceivePort\Service
尝试-LiteralPath
,尝试使用单引号
答案 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()