Home/PowerShell/Add Binding To IIS – PowerShell

Add Binding To IIS – PowerShell

Hi Guys, today we are going to disuses about how to add the binding to IIS using Powershell. In most case, during the deployments, the one of the painful activity is adding binding for new sites. So this below posts will help those members to one step towards of Automation.

The New-WebBinding cmdlet adds a new binding to an existing website.

Explanation:

The New-WebBinding cmdlet adds a new binding to an existing website.

New-WebBinding -Name $web -IPAddress “*” -Port 80 -protocol http -HostHeader $Website -sslflags 0

-NameThe name of the Web site on which the new binding is created.
-IPAddressThe IP address of the new binding.
-PortThe port used for the binding.
-ProtocolThe protocol to be used for the Web binding (usually HTTP, HTTPS, or FTP).
-HostHeaderThe host header of the new binding.
-SslFlagsIndicates what type of certificate OR certificate storage the new website supports. Only the below values are valid:

0 (Regular certificate in Windows certificate storage),
1 (SNI certificate),
2 (central certificate store),
3 (SNI certificate in central certificate store).

 

 

What do you think?

I hope you have idea of how to add the binding to IIS using Powershell Script. I would like to have feedback from my posts readers. Your valuable feedback, question, or comments about this article are always welcome.

2 Comments

  1. Imran July 24, 2018 at 6:41 am

    I have to move one site to another server which has around 500 site bindings. How can I achieve this. I am totally zero about the power shell script but knows c#.net. Any help is deeply appreciated.

  2. Thiyagu August 6, 2018 at 1:03 pm

    Hi Imran,

    Thanks for your Prompt question. It can be achievable in single line of command in Command prompt. Please refer the link https://dotnet-helpers.com/iis/exporting-and-importing-website-in-iis

Leave a Reply