You want to find the amount of whitespace in your DIT. A lot of whitespace in the DIT may mean that you could regain enough space on the disk to warrant performing an offline defrag.
Run regedit.exe from the command line or Start Run.
Expand HKEY_LOCAL_MACHINE SYSTEM CurrentControlSet Services NTDS Diagnostics.
In the right pane, double-click on 6 Garbage Collection.
For Value data, enter 1.
> reg add HKLM\System\CurrentControlSet\Services\NTDS\Diagnostics /v "6 Garbage[RETURN] Collection" /t REG_DWORD /d 1
' This code enables logging of DIT whitespace information in the event log. ' ------ SCRIPT CONFIGURATION ------ strDCName = "<DomainControllerName>" ' e.g. dc1 ' ------ END CONFIGURATION --------- const HKLM = &H80000002 strNTDSReg = "SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics" set objReg = GetObject("winmgmts:\\" & strDCName & "\root\default:StdRegProv") objReg.SetDWORDValue HKLM, strNTDSReg, "6 Garbage Collection", 1 WScript.Echo "Garbage Collection logging set to 1"
By setting the 6 Garbage Collection diagnostics logging option, event 1646 will get generated after the garbage collection process runs. Here is an example 1646 event:
Event Type: Information Event Source: NTDS Database Event Category: Garbage Collection Event ID: 1646 Date: 5/25/2003 Time: 9:52:46 AM User: NT AUTHORITY\ANONYMOUS LOGON Computer: DC1 Description: Internal event: The Active Directory database has the following amount of free hard disk space remaining. Free hard disk space (megabytes): 100 Total allocated hard disk space (megabytes): 1024
This shows that domain controller dc1 has a 1 GB DIT file with 100 MB that is free (i.e., whitespace).
Recipe 16.12 for performing an offline defrag