Here’s a quick Powershell script that will check your AD database (on Windows Server 2008 R2) for any errors and attempt to fix (some of) them. Running this before creating an IFM media set is highly recommended since it will identify AD database errors.
1 2 3 4 5 6 | Write-Output "Checking the NTDS database for errors (semantic database analysis) `r " Stop-Service ntds -force $NTDSdbChecker = ntdsutil "activate instance ntds" "verbose on" "semantic database analysis" "Go" q q Start-Service ntds Write-Output "Results of Active Directory database integrity check: `r " $NTDSdbChecker |
If you want the script to check the AD database and attempt to fix them, run this:
1 | $NTDSdbChecker = ntdsutil "activate instance ntds" "verbose on" "semantic database analysis" "Go Fixup" q q |
Note that replacing “Go” with “Go Fixup” runs the semantic check and will attempt to fix any errors.
Also, you can remove the “verbose on” part – I like to see what is happening.
Unlike the file management commands …, which test the integrity of the database with respect to the ESENT database semantics, the semantic analysis analyzes the data with respect to Active Directory semantics. It generates reports on the number of records present, including deleted and phantom records.
References: