import certificate to certificate store and bind it to IIS using command line
-
Monday, May 21, 2012 10:05 AM
Hi,I created a certificate ssl.cer on CA using the certificate request.
Now I want to import this certificate into Certificate store on the server for which request was created and bind it to IIS on port 443.
I know how to do this using GUI.
I am looking to do it using command line so that I can automate it in a batch script.
Please help me.
Ankur
All Replies
-
Monday, May 21, 2012 2:50 PMModerator
Hi,
Try a web search and then you don't need to wait for an answer in the forum. For example:
http://lmgtfy.com/?q=import+certificate+command+line
Bill
-
Monday, May 21, 2012 3:02 PM
Here is the SDK method for installin a pfx file as a certificate.
' args are pfxfile, pfxfilepassword, WebFarmServers, username, password Set iiscertobj = WScript.CreateObject("IIS.CertObj") pfxfile = WScript.Arguments(0) pfxfilepassword = WScript.Arguments(1) InstanceName = WScript.Arguments(2) WebFarmServers = split(WScript.Arguments(3), ",") iiscertobj.UserName = WScript.Arguments(4) iiscertobj.UserPassword = WScript.Arguments(5) For Each IISServer in WebFarmServers iiscertobj.ServerName = IISServer iiscertobj.InstanceName = InstanceName iiscertobj.Import pfxfile, pfxfilepassword, true, true NextHere is how to convert a CER to a PFX.
http://www.ehow.com/how_8586664_convert-cer-pfx.html
¯\_(ツ)_/¯
- Marked As Answer by IamMredMicrosoft Employee, Owner Friday, May 25, 2012 8:43 PM
-
Monday, May 21, 2012 8:25 PMModerator
To import the certificate, I use Certutil. Take a look here for the command line reference.
To bind the cert use netsh. Read here.
Blog: http://scriptimus.wordpress.com/
- Marked As Answer by IamMredMicrosoft Employee, Owner Friday, May 25, 2012 8:43 PM

