IIS on Windows Server 2019
In the IIS Manager, select the FTP site, then click the icon for "FTP SSL Settings". Here you can select the available WebHosting store SSL Certificate using the dropdown. I need to be able to do that in a batch file at the command line. Note, not using PowerShell.
The following commands work fine for the "website" itself which has a domain name. But I need to bind the FTP site on port 21 to a certificate also and it doesn't have a domain itself. "blahblah" are different hashes, just saving space, and domain.com is in place of the real domain.
certutil -delstore "WebHosting" "*.domain.com"
certutil -f -p "password" -importpfx "WebHosting" "WEB.pfx"
certutil -repairstore "WebHosting" "www.domain.com" "change-friendly-name.inf"
netsh http add sslcert certstorename=WebHosting hostnameport=www.domain.com:443 certhash=blahblah appid=blahblah
\windows\system32\inetsrv\appcmd set site /site.name:"WEBweb" /+bindings.[protocol='https',bindingInformation='*:443:www.domain.com']
\windows\system32\inetsrv\appcmd renew binding /oldcert:blahblah /newcert:blahblah
So I tried this:
\windows\system32\inetsrv\appcmd set site /site.name:"WEBftp" /+bindings.[protocol='ftp',bindingInformation='*:21:']
But it doesn't seem to work.
Am I perhaps using the wrong commands since I've been trying different things for so long I've confused myself? Is there a way to select and bind a cert to a site that doesn't have a domain name?
I'm sure the secret lies in one of these commands:
netsh
certutil
appcmd