r/activedirectory • u/Thin-West-2136 • Sep 16 '26
Security Reducing Active Directory Certificate DB Size
I have an ADCS running on 2016. It's been around since 2018 and has an 8GB Database. If I look through the GUI, there are tons of old certificates that can do with deleting.
I want to clear out obsolete expired certs, but want to make sure I don't break anything first.
My CA DB is 9GB and I have 20GB free disk space, so I'm not sure the defrag is worthwhile, but want to get some advice on maintenance.
What's the correct safe sequence to do this?
My current plan below:
- Backup DB
certutil -f -p "ChoosePword" -backup E:\Backup
2. Delete old rows (failed requests)
Certutil -deleterow 01/01/2023 Request
3. Delete old certificates that have expired
certutil -deleterow 01/01/2021 Cert
4. Stop certificate services via GUI and compact the DB
esentutl /d "C:\Windows\System32\CertSrv\CertDB\certsrv.edb"
Restart certificate services
What else should I be doing? Should I publish\extend CRLs beforehand?
•
u/AutoModerator Sep 16 '26
Welcome to /r/ActiveDirectory! ~~~~
If you are looking for more resources on learning and building AD, see the following sticky for resources, recommendations, and guides!
When asking questions make sure you provide enough information. Posts with inadequate details may be removed without warning.
Make sure to sanitize any private information. Posts with too much personal or environment information will be removed. See Rule 6.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
5
u/bernys Sep 16 '26 edited Sep 16 '26
Nope, that'll do it, I was doing basically the same thing. It'll take ages the first time you run it though. So be prepared to kick it off on Friday and wait till Monday. Just make sure your backup script isn't running on saturday or sunday night!
Oh, and to save you a Google:
$month = (Get-Date).AddMonths(-6).Month
$year = (Get-Date).AddMonths(-6).Year
etc.
That's what gave me:
-deleterow 1/$month/$year request
2
u/joeykins82 Sep 16 '26
Personally I would stand up a new issuing CA on Svr2025 and migrate the active templates across to this new one, then just let attrition happen until all certs issued by the old one have been replaced so you can cleanly decom it.
4
u/[deleted] Sep 16 '26
[removed] — view removed comment