tags:

views:

1625

answers:

1

I am trying to configure the website SSL port with the certificate for a website within IIS 6.0 programmatically.

IIS 7.0 provides the API, ServerManager, to do so, but I am not sure if there is something similar for IIS 6.0 or command line utilities.

Thanks in advance!

+4  A: 

If you mean just setting the port NUMBER programmatically, you can use the metabase command line tool (by default in C:\Inetpub\AdminScripts):

cscript adsutil.vbs set w3svc/1/securebindings ":nnn:"

where nnn is the port number (e.g., ":443:"). (If you have more than one site on the server, you will need to substitute w3svc/x/securebindings, where x is the web site ID.)

If you actually need to install the CERTIFICATE programmatically, from what I gather there's a script in the IIS 6.0 Resource Kit to do it (IISCertDeploy.vbs) but I've not tried it.

Eric Rosenberger
Oh Excellent!! how about set up the SSL certificate name associate with it?
codemeit
I believe this is what IISCertDeploy.vbs is supposed to do, although again I haven't tried it so you may have to play around with it.
Eric Rosenberger
I found something interesting and thought share with you.after setting up the ssl port of the site as you mentioned above, all I need to do is to use httpcfg to set ssl for the same port. In IIS website, it will show port is with the right cert. Thanks.
codemeit