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
Complete any remaining instructions in this PowerShell session unless directed otherwise
Modify then run the following commands to define the full path to certificate file:
$cert_file = 'C:\Content\certificate\host_domain_utexas_edu_cert.cer'
Run the following commands to import the certificate:
$cert_store = 'Cert:\LocalMachine\My' $cert_object = Import-Certificate -CertStoreLocation $cert_store -FilePath $cert_file
Run the following commands to replace the certificate:
The following commands will alert 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
$cert_match = Get-ChildItem -Path $cert_store | Where-Object {$_.Subject -eq $cert_object.Subject -and $_.Issuer -eq $cert_object.Issuer } | Sort-Object -Property NotBefore -Descending If ($cert_match.Count -eq 2) { Try { Switch-Certificate -OldCert $cert_match[1] -NewCert $cert_match[0]; Remove-Item $cert_match[1] } Catch { Write-Host "Error replacing or removing certificate" } }