Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
typeflat

Prerequisites

  • Ensure the signed certificate files is on or accessible by the system that created the original certificate request

Install the certificate request 

  1. 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

  1. Run the following commands

...

  1. to define the certificate to be imported: 

    Code Block

...

  1. languagepowershell
    $Path = Read-Host -Prompt "Provide the path to the certificate file"
    

...

  1. $Name = Read-Host -Prompt "Provide the name of the certificate file"
  2. Run the following commands to

...

  1. retrieve the certificate to be imported:

...

  1. Code Block

...

  1. languagepowershell
    $CertificateFilePath = Get-ChildItem -Path 

...

  1. $Path | Where-Object { $_.Name -Match 

...

  1. $Name } | Sort-Object -Property LastWriteTime | Select-Object -Last 1 

...

  1. -ExpandProperty FullName
  2. Run the following commands to verify the certificate to be imported: 

    Code Block
    languagepowershell
    $CertificateFromFile = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2(

...

  1. $CertificateFilePath)
    

...

  1. $CertificateFromFile | Select-Object -Properties Thumbprint, HasPrivateKey, NotBefore, NotAfter, Subject, Issuer
  2. Run the following commands to

...

  1. 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. 

  1. Code Block
    languagepowershell
    $CertStoreLocation = 'Cert:\LocalMachine\My'

...

Update the certificate  

  1. Run the following commands

...

  1. 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

...

  1. Code Block
    languagepowershell
    $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 

...