I'm creating an IIS web site using PowerShell's New-WebSite
cmdlet, and within that a web application using New-WebApplication
.
The SSL settings for the web application need to be set to Require SSL; Require as shown below.
For consistency, I would like to do this using only PowerShell cmdlets.
The Require SSL setting is easy; you just add the -Ssl
parameter to New-Website
.
However, the only way we've found to set the Require option is using Appcmd.exe
:
& $env:SystemRoot\System32\inetsrv\Appcmd.exe `
set config "$WebSiteName/$VirtualDirName" `
/section:access `
/sslFlags:"SslRequireCert" `
/commit:APPHOST
Is there a PowerShell alternative to this?