Powershell – Installing an SSL Certificate in Windows Server 2008 using powershell

command-line-interfacepowershellwindows-server-2008windows-server-2008-r2

Is it possible to Install an SSL Certificate in Windows Server 2008 R2 using powershell?

If it's not, is it possible with cmd command line?

I am doing it with mmc now but would it be nice to do that with PowerShell.

Best Answer

You can use certutil.exe. The exact syntax varies based on the the certificate file format (.cer, .pfx...), but one of these options should be able to do the trick:

certutil -addstore my <filename>
certutil -installcert <filename>
certutil -importcert <filename>
certutil -importpfx <filename>

More info here: http://technet.microsoft.com/en-us/library/cc772898(WS.10).aspx.


This also can be done in native PowerShell, but it's a lot more complex, as there is no built-in command for certificate management, so you have to use the .NET X.509 library (System.Security.Cryptography.X509Certificates).