如何完整编写导入SSL证书并将此证书绑定到特定站点的过程

时间:2010-02-22 23:12:47

标签: asp.net iis ssl windows-server

我一直在寻找解决此问题的解决方案,该解决方案适用于不同版本的Windows Server& IIS,但到目前为止我找不到一个合理的解决方案,我需要的是某种脚本或命令行工具,例如采用证书文件(pfx),然后使用相同的脚本或工具找到一个配置一个网站以使用此证书的方法。

1 个答案:

答案 0 :(得分:0)

我在TechNet上找到了一个好的脚本

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/96ccb49f-b669-4e05-965e-3090984a3594.mspx?mfr=true

CertImport.vbs

Option Explicit
Dim iiscertobj, pfxfile, pfxfilepassword, InstanceName, WebFarmServers, IISServer
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
Next