使用Powershell从IIS中删除net.msmq绑定

时间:2012-04-11 21:39:09

标签: iis powershell iis-7.5 msmq

使用Powershell自动化一些IIS内容。我需要使用此处列出的方法添加net.msmq绑定: Why Powershell's New-WebBinding commandlet creates incorrect HostHeader?

我使用

之类的东西添加
New-ItemProperty -Path 'IIS:\Sites\Default Web Site' -Name Bindings -value @{protocol="net.msmq"; bindingInformation="server.domain.com"}

所以现在我需要自动删除该绑定(比如队列服务器更改)。我已经搞乱了所有Collection cmdlet,我无法找到删除项目的方法。

Get-ItemProperty -Path 'IIS\Sites\Default Web Site' -Name bindings 

将返回一个集合。我可以使用ForEach进行迭代,但是一旦找到它,我似乎无法找到删除项目的魔法命令。

有什么想法吗?

2 个答案:

答案 0 :(得分:1)

这对我有用:

$prop = (get-ItemProperty -Path 'IIS:\Sites\Default Web Site' -Name bindings).Collection | ? {$_.Protocol -ne "net.msmq"}
Set-ItemProperty "IIS:\sites\Default Web Site" -name bindings -value $prop

答案 1 :(得分:0)

Remove-ItemProperty'IIS:\ Sites \ DemoSite'-Name bindings -AtElement @ {protocol =“http”; bindingInformation =“*:80:DemoSite2”}

直接关闭了技术网......

相关问题