Steve's blog

A blog about what's going on in Analysis UK...

Configuring IIS 7 Bindings with IIS PowerShell Provider

I searched a fair amount for information on how to add binding information to an existing website under IIS 7 and found few decent examples, the best was PowerShell Snap-in: Configuring SSL with the IIS PowerShell Snap-in which details setting up a website for SSL, but had most of the information I needed.

Naturally it would have helped if I'd remembered the that PowerShell uses New- as well as Add- and had not got my brain stuck into thinking of the bindings as a collection/dictionary, I might have noticed New-WebBinding earlier!

If like me you have a lot of domain names pointing to a single web application (more on this in a future post) you will want to add the binding information for each of the domain names, as well as the www subdomain.

So, here's how to do it (yes, this is more of a reminder to myself for next time!)

a) Fire up the IIS PowerShell console.

b) Check your websites and current binding information by browsing to IIS:\sites


c) Check your current bindings with Get-WebBinding -Name <WebSiteName>


d) Add a new binding with

      New-WebBinding -Name <WebSiteName> -IP "*" -Port 80 -Protocol http -HostHeader <Domain/Host name>


Here's how it looks in IIS manager.


If like me you have a lot of different domains that point to the same IIS site, just add some PowerShell script and you can add a load of domains in one hit, nice and simple!