Austin Certificates - How-To - Replace Windows certificates
Prerequisites
A replacement certificate has been installed for an existing certificate
The replacement and existing certificate have the same subject
Retrieve the certificates
Sign in to the computer where the certificates are installed then start an administrative PowerShell session
Run the following commands to define the certificates to be updated:
$Subject = Read-Host -Prompt "Provide the subject of the certificate to be updated"Run the following commands to define the certificate store:
$CertStoreLocation = 'Cert:\LocalMachine\My'Run the following commands to retrieve the certificates to be updated:
$Certificates = Get-ChildItem -Path $CertStoreLocation | Where-Object { $_.Subject -eq $Subject } | Sort-Object -Property NotBefore
Update the certificate
Run the following commands to replace the certificate:
Switch-Certificate -OldCert $Certificates[-2] -NewCert $Certificates[-1]