Remove a net.msmq binding from IIS using Powershell

Automating some IIS stuff with Powershell. I needed to add an net.msmq binding using the approach listed here: Why Powershell's New-WebBinding commandlet creates incorrect HostHeader?

Where I add using something like

New-ItemProperty -Path 'IIS:\Sites\Default Web Site' -Name Bindings -value @{protocol="net.msmq"; bindingInformation=""}

So now I need to automate removal of that binding (say the queue server changes). I have messed around with all the Collection cmdlets, and I cannot figure out a way to remove an item.

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

will return a collection. I can iterate through with ForEach, but I cannot seem to find the magic command to remove an item once I find it.

Any thoughts?


This worked for me:

$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

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

straight off the technet......

Need Your Help

developer tools for os' other than windows

linux macos ide solaris

I currently use visual studio 2008 for creating projects that can run on windows. Can you recommend me of other tools that can be used to develop applications for other operating systems?(Linux, Mac,

Android studio Error "Unsupported Modules Detected: Compilation is not supported for following modules"

android intellij-idea android-studio ide android-ide

I am using Android studio 1.0.1. I have a java module referred by other modules in my project. I have checked it out from SVN But now every