Creating SSL binding - New-WebBinding vs Set-WebConfigurationPropertyRSS

4 replies

Last post Jan 08, 2014 11:24 PM by GJCanon

  • Creating SSL binding - New-WebBinding vs Set-WebConfigurationProperty

    Jan 08, 2014 01:25 AM|GJCanon|LINK

    Hi,

    What would be the difference of the following two commands:

    Add-WebConfigurationProperty -Filter '/system.applicationHost/sites/site[@name="mytestsite.local"]' -Name Bindings -Value (@{protocol="https";bindingInformation="*:443:mytestsite.local"}) -PSPath "IIS:\"

    or:

    New-WebBinding -name "mytestsite.local" -IP "*" -Port 443 -Protocol https

  • Re: Creating SSL binding - New-WebBinding vs Set-WebConfigurationProperty

    Jan 08, 2014 09:28 AM|Perkinsville|LINK

    Hi,

    They both do the same.  But in your example, the Add-WebConfigurationProperty contains a hostname and the New-WebBinding does not.

    Additionally, when I executed the Add-WebConfigurationProperty that included a web site that does not exist, nothing happened.  When I did the same with New-WebBinding I received an error and needed to provide a valid web site name.

    Both can be used to create a binding for a website.

    NOTE:  You might want to perform the same using the Configuration Edito in IIS8+ and see what the generated script is for PowerShell.

    HTH, Benjamin

  • Re: Creating SSL binding - New-WebBinding vs Set-WebConfigurationProperty

    Jan 08, 2014 04:44 PM|GJCanon|LINK

    Good call on the lack of a hostname in the second entry. I should have included that.

    Is there a way to catch or detect errors when specifying the wrong site name?

    Set-WebConfigurationProperty addwebconfigurationproperty NewWebBinding

  • Rovastar Rovastar

    5459 Posts

    MVP

    Moderator

    Re: Creating SSL binding - New-WebBinding vs Set-WebConfigurationProperty

    Jan 08, 2014 05:10 PM|Rovastar|LINK

    What do you mean by the wrong site name? Invalid character, wrong because you need it to be something else?

    Set-WebConfigurationProperty addwebconfigurationproperty NewWebBinding

    Troubleshoot IIS in style
    https://www.leansentry.com/
  • Re: Creating SSL binding - New-WebBinding vs Set-WebConfigurationProperty

    Jan 08, 2014 11:24 PM|GJCanon|LINK

    As in, if the site doesn't exist at all, it doesn't seem to throw an error or exception.

    Set-WebConfigurationProperty addwebconfigurationproperty NewWebBinding