使用 powershell 在 Windows Server 2008 中安装 SSL 证书

tug*_*erk 6 powershell windows-server-2008 command-line-interface windows-server-2008-r2

是否可以使用 powershell 在 Windows Server 2008 R2 中安装 SSL 证书?

如果不是,是否可以使用 cmd 命令行?

我现在正在用 mmc 做这件事,但用 PowerShell 做这件事会很好。

Mas*_*imo 5

您可以使用certutil.exe. 确切的语法因证书文件格式(.cer、.pfx...)而异,但这些选项之一应该能够做到这一点:

certutil -addstore my <filename>
certutil -installcert <filename>
certutil -importcert <filename>
certutil -importpfx <filename>
Run Code Online (Sandbox Code Playgroud)

更多信息请访问:http : //technet.microsoft.com/en-us/library/cc772898(WS.10).aspx


这也可以在本机 PowerShell 中完成,但要复杂得多,因为没有用于证书管理的内置命令,因此您必须使用 .NET X.509 库 ( System.Security.Cryptography.X509Certificates)。