Prerequisites

Install the certificate request 

  1. Sign in to the computer where the certificate was originally requested then start an administrative PowerShell session

  2. Run the following commands to define the certificate to be imported: 

    $Path = Read-Host -Prompt "Provide the path to the certificate file"
    $Name = Read-Host -Prompt "Provide the name of the certificate file"
  3. Run the following commands to retrieve the certificate to be imported:

    $CertificateFilePath = Get-ChildItem -Path $Path | Where-Object { $_.Name -Match $Name } | Sort-Object -Property LastWriteTime | Select-Object -Last 1 -ExpandProperty FullName
  4. Run the following commands to verify the certificate to be imported: 

    $CertificateFromFile = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($CertificateFilePath)
    $CertificateFromFile | Select-Object -Properties Thumbprint, HasPrivateKey, NotBefore, NotAfter, Subject, Issuer
  5. Run the following commands to define the certificate store:

    $CertStoreLocation = 'Cert:\LocalMachine\My'
  6. Run the following commands to import the certificate: 

    $CertificateObject = Import-Certificate -FilePath $CertificateFilePath -CertStoreLocation $CertStoreLocation
    $CertificateObject | Select-Object -Properties Thumbprint, HasPrivateKey, NotBefore, NotAfter, Subject, Issuer