This script uses eseutil
to perform offline defragmentation and compaction of Exchange mailbox databases, helping reclaim unused space and improve performance.
# Dismount database
Dismount-Database -Identity "Mailbox Database 001"
# Defrag the database (adjust path as needed)
eseutil /d "E:\ExchangeDB\Mailbox Database 001.edb" /t"E:\Temp\DBDefrag.edb"
# Mount database back
Mount-Database -Identity "Mailbox Database 001"
This script must be run during off-hours. Always take a full backup before running offline defrag.
© 2012–2025 Jet Mariano. All rights reserved.
For usage terms, please see the Legal Disclaimer.