How to Export and Import SSL Certificates on Windows Servers.
[
Exporting] and [
importing] [
SSL Certificates] are a necessary evil for all [
Network Administrators].
In this Article, we will copy files from one server to all others within our Network.
There will be two codes for each command.
1 - copy and paste into PowerShell
2 - Copy and paste into a file, name it with a .ps1 extension.
▼ Export SSL Certificate ▼
If you are using a different machine, you will need the first line; otherwise, omit it.
This will connect you to the server from which you will export the certificate.
[
PS1] Version
▼ Copy from one Server to another Server ▼
If you are like me and have many machines to apply this Cert to, do the following.
Run the following command (I always give my certs the date they were made as their name; this helps when deleting the old ones on each machine).
[
PS1] (Each within their own, this makes it easier to catch any issues during the copying process.)
▼ Import SSL Certificate ▼
Next, we will [
import] the new [
SSL Certificate] into each of the Servers to which we copied the files.
Enter-PSSession -ComputerName WebCore2
$pwd = ConvertTo-SecureString -String "YOURPASSWORDGOESHERE" -Force -AsPlainText
Import-PfxCertificate -FilePath G:\SSL\DOMAINNAME-02-14-2026.pfx Cert:\LocalMachine\WebHosting -Password $pwd
Exit-PSSession
Enter-PSSession -ComputerName WebCore4
$pwd = ConvertTo-SecureString -String "YOURPASSWORDGOESHERE" -Force -AsPlainText
Import-PfxCertificate -FilePath G:\SSL\DOMAINNAME-02-14-2026.pfx Cert:\LocalMachine\WebHosting -Password $pwd
Exit-PSSession
[
PS1] (Each within their own, this makes it easier to catch any issues during the copying process.)
▼ Set IIS to use new SSL Certificate ▼
Next, open [
IIS]
Select each Domain
Go into [
Bindings]
Set each [
domain] and [
sub-domain] to the new Cert.