If you restore a DC and it starts in Safe Mode, probably, your AD DB is corrupted . For this reason, when you try to boot, it starts starts automatically in Directory Services Restore Mode .
To resolve this problem, we need to fix the corrupted DB through ESEUTIL utility.
Open a Powershell and issue this command:
1 |
ESENTUTL /g C:\windows\NTDS\ntds.dit /!10240 /8 /o |
![](https://marcoschiavon.net/wp-content/uploads/2022/03/Screenshot-2022-03-08-at-15.02.37-scaled.jpg)
At this point we need to try to recover the DB.
1 |
ntdsutil |
![](https://marcoschiavon.net/wp-content/uploads/2022/03/Screenshot-2022-03-08-at-15.06.10.jpg)
Now type
1 |
activate instance ntds |
![](https://marcoschiavon.net/wp-content/uploads/2022/03/Screenshot-2022-03-08-at-15.07.21.jpg)
Type
1 |
files |
![](https://marcoschiavon.net/wp-content/uploads/2022/03/Screenshot-2022-03-08-at-15.09.34.jpg)
Type
1 |
info |
![](https://marcoschiavon.net/wp-content/uploads/2022/03/Screenshot-2022-03-08-at-15.09.45.jpg)
At this point, we will try a “soft” recover.
Type
1 |
recover |
![](https://marcoschiavon.net/wp-content/uploads/2022/03/Screenshot_2022-03-08_at_15_16_44.jpg)
In my case I received an error ” *** Error: Operation not allowed because AD DS/LDS files are in the restored state. Restart the directory instance to finalize the restore process “
In this case go to c:\windows\NTDS
Create a OLD folder and move the *.log and *.chk into .
![](https://marcoschiavon.net/wp-content/uploads/2022/03/Screenshot-2022-03-08-at-15.24.01-1024x500.jpg)
After that issue an “hard” recovery with this command :
1 |
ESENTUTL /p C:\Winnt\NTDS\ntds.dit /!10240 /8 /o |
![](https://marcoschiavon.net/wp-content/uploads/2022/03/Screenshot-2022-03-08-at-15.28.20-1024x539.jpg)
at this point re-run the /g to check the DB consistency
1 |
ESENTUTL /g C:\windows\NTDS\ntds.dit /!10240 /8 /o |
good!
![](https://marcoschiavon.net/wp-content/uploads/2022/03/Screenshot-2022-03-08-at-15.30.16-1024x371.jpg)
After that, run MSCONFIG and deselect the “Active Directory Repair”
![](https://marcoschiavon.net/wp-content/uploads/2022/03/Screenshot-2022-03-08-at-15.45.52-1024x683.jpg)
![](https://marcoschiavon.net/wp-content/uploads/2022/03/Screenshot-2022-03-08-at-15.45.59-1024x687.jpg)
Reboot and it’s done.
Thanks a lot !