Security MVP Vadims Podans just did a great post on using PowerShell to remove expired user certificates from Active Directory.
In a nutshell,
- If your company is using certificates for user authentication or encryption, these expire every now and then,
- Your Enterprise CA in that case appends new certificates to users’ userCertificate attribute, while leaving expired certs there as well,
- Over time these increasingly clutter your AD, making administration more difficult and negatively affecting AD replication traffic.
Luckily, cleaning up expired certificates with PowerShell is extremely easy.
To do the clean-up for a specific user you can run this one-liner:
Get-QADUser username | Remove-QADCertificate -Valid:$false
To clean-up the entire domain, just do:
Get-QADUser | Remove-QADCertificate -Valid:$false
See Vadim’s original post for details.
Read more about PKI management with PowerShell here.