New-WebBinding Problem with SSL Flags

5 February 2022

Recently I tried to run the following code in PowerShell:

New-WebBinding -name Hahndorf -Protocol https -HostHeader -Port 443 -SslFlags 33

but got the following error:

New-WebBinding : Parameter 'SslFlags' value is out of range: 0-3.

In recent years, the IIS team gave us more options for a https bindings, but the WebAdministration cmdLets were not updated to reflect this.

What if we need to use a higher SslFlags value than 3?

We just need to set the SslFlags value by hand:

New-WebBinding -name Hahndorf -Protocol https -HostHeader -Port 443 -SslFlags 1
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/sites/site[@name='Hahndorf']/bindings/binding[@protocol='https' and @bindingInformation='*']" -name "sslFlags" -value 33

You have to specify the name of the site and the binding you want to update.

Pages in this section


ASP.Net | Community | Development | IIS | IT Pro | Security | SQL (Server) | Tools | Web | Work on the road | Windows