By default Windows runs an online Defragmentation of the Windows Active Directory database every 12 hours. However, Online defragmentation doesn’t recover the disk space or compact the database. It simply moves data around.
An Offline Defragmentation, on the other hand performs a defragmentation on the database, compacts it and recovers the space. Use the “ntdsutil” utility to run Offline Degramentation on Windows Active Directory. This requires unmounting the Active Directory which mean rebooting the server in “Directory Service Restore mode”.