| Table of Contents | ||
|---|---|---|
|
Prerequisites
Ensure the signed certificate files is on or accessible by the system that created the original certificate request
Install the certificate request
Sign in to the computer where the certificate was originally requested then start an administrative PowerShell session
| Info |
|---|
Complete any remaining instructions in this PowerShell session unless directed otherwise |
Run the following commands
...
to define the certificate to be imported:
Code Block
...
language powershell $Path = Read-Host -Prompt "Provide the path to the certificate file"
...
$Name = Read-Host -Prompt "Provide the name of the certificate file"
Run the following commands to
...
retrieve the certificate to be imported:
...
Code Block
...
language powershell $CertificateFilePath = Get-ChildItem -Path
...
$Path | Where-Object { $_.Name -Match
...
$Name } | Sort-Object -Property LastWriteTime | Select-Object -Last 1
...
-ExpandProperty FullNameRun the following commands to verify the certificate to be imported:
Code Block language powershell $CertificateFromFile = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2(
...
$CertificateFilePath)
...
$CertificateFromFile | Select-Object -Properties Thumbprint, HasPrivateKey, NotBefore, NotAfter, Subject, Issuer
Run the following commands to
...
define the certificate store:
...
| Info |
|---|
The Import-Certificate command will import certificates into the certificate store of the current user. The certificate store of the computer is specified by using the "CertStoreLocation" parameter with the Cert:\LocalMachine\My value. |
Code Block language powershell $CertStoreLocation = 'Cert:\LocalMachine\My'
...
Update the certificate
Run the following commands
...
to import the certificate:
| Info |
|---|
The commands below are optional and will alert most Windows applications that an old certificate has been replaced by a new one. Only applications that subscribe to certificate notifications will be affected by these commands |
...
Code Block language powershell $CertificateObject = Import-Certificate -FilePath $CertificateFilePath -CertStoreLocation $CertStoreLocation $CertificateObject | Select-Object -Properties Thumbprint, HasPrivateKey, NotBefore, NotAfter, Subject, Issuer
...
Run the following commands to remove the previous certificate
...