Skip to content
Tutorials Center
My learning

Topics

Lesson 35 of 38 ยท Administration

Backup, Recovery and Maintenance of Active Directory

Back up and recover Active Directory: system state backups, tombstone lifetime, the Recycle Bin, authoritative and non-authoritative restore, DSRM, forest recovery and routine health checks.

Active Directory is replicated, so people sometimes believe it does not need backups: if one domain controller dies, another has the data. Replication, however, is just as good at spreading a mistake as at spreading a good change. A script that deletes the wrong OU deletes it everywhere within minutes. Ransomware that reaches the domain controllers encrypts every copy. Backups, a tested recovery plan and a few routine checks are what turn a disaster into an inconvenience.

This lesson explains what to back up, the time limits that matter, the recovery methods from "undo one delete" to "rebuild the forest", and the maintenance tasks. The recovery tools are Windows-specific and run only on domain controllers, so the commands are read-only. Python stand-ins calculate the time windows and model the lifecycle of a deleted object.

What to back up

  • System State of at least two domain controllers per domain (including one holding FSMO roles, and one in each major location). System State contains the directory database (ntds.dit) and logs, SYSVOL, the registry, boot files, the certificate services database and DNS zone data stored in AD.
  • A bare-metal or full-server backup if you need fast rebuilds.
  • GPO backups (GPMC export) and exports of critical configuration (DNS zones, DHCP, CA settings), kept off the domain: a backup stored only on a domain-joined file server is reachable by the same attacker.
  • Keep a copy that is offline or immutable, protected from the domain's administrators, and test restores regularly. A backup nobody has ever restored is a hope, not a plan.
TEXT
wbadmin start systemstatebackup -backupTarget:E: -quiet
wbadmin get versions
wbadmin get items -version:03/02/2026-02:00

Tombstone lifetime and backup age

When an object is deleted, AD does not remove it at once. It becomes a tombstone (a stub with isDeleted=TRUE) that replicates, so every DC learns about the deletion. Tombstones are purged after the tombstone lifetime, 180 days by default in current forests (attribute tombstoneLifetime on CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration). That number limits two things:

  1. Backups older than the tombstone lifetime are not usable for restoring a domain controller: restoring one would bring back objects that other DCs already purged, creating lingering objects and breaking replication.
  2. A DC that has been offline longer than the lifetime must not be reconnected; demote it forcibly or rebuild it.

So a rule of thumb: keep at least one good backup less than 180 days old at all times, and in practice back up daily.

Python Is this backup still safe to restore?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The Active Directory Recycle Bin

If the Recycle Bin is enabled (forest functional level 2008 R2 or later; enabling is irreversible), deleted objects pass through two states:

flowchart LR
  A["Live object"] -- "delete" --> B["Deleted object (recoverable, all attributes kept)"]
  B -- "after msDS-deletedObjectLifetime (180 days)" --> C["Recycled object (attributes stripped, not restorable)"]
  C -- "after tombstone lifetime" --> D["Purged"]
  B -- "Restore-ADObject" --> A

Without the Recycle Bin, a deleted object is a tombstone with most attributes removed, and restoring it loses group memberships and more.

The default deleted-object lifetime equals the tombstone lifetime, so you have about 180 days (the two lifetimes add up to 360 days before purge in the Recycle Bin model, with the first period restorable). Restoration is online and does not need a restart:

POWERSHELL
Get-ADObject -Filter 'isDeleted -eq $true -and Name -like "Finance*"' -IncludeDeletedObjects -Properties lastKnownParent
Restore-ADObject -Identity <ObjectGUID>

Restore a parent OU before its children; if an OU is deleted, restore it first, then the objects. Protect OUs from accidental deletion (the checkbox Protect object from accidental deletion, set by default in recent consoles).

Python Lifecycle of a deleted object (Recycle Bin on or off)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Restore methods

Non-authoritative restore. Restore System State on a DC in Directory Services Restore Mode (DSRM) and let it boot normally. Replication then brings it up to date. Use this when a DC itself is broken. Easier: build a new DC and promote it instead of restoring.

Authoritative restore. You deleted something on purpose or by mistake and replication already spread it. Restore from a backup in DSRM, then use ntdsutil to mark the objects as authoritative, which raises their version numbers (by 100,000 by default) so they win over the deletion when replicated:

TEXT
ntdsutil
activate instance ntds
authoritative restore
restore subtree "OU=Finance,DC=example,DC=com"
quit
quit

On reboot the restored subtree replicates outward. Group membership links must be restored separately for objects that were in groups; ntdsutil writes an LDIF file for the back-links. With the Recycle Bin you can usually skip all of this.

DSRM. To enter it, set bcdedit /set safeboot dsrepair, reboot, and log in with the DSRM password set at promotion (reset with ntdsutil > set dsrm password). Keep the DSRM passwords of all DCs in your password vault.

Forest recovery. When every DC is compromised (ransomware, widespread corruption), you restore one writable DC per domain from a known-good backup, seize the FSMO roles, clean the metadata of the lost DCs, reset the krbtgt password twice, reset trust and computer account passwords, and rebuild the other DCs by promotion. Microsoft publishes the full Forest Recovery Guide, and you should rehearse it in an isolated lab at least once, because the first time during a real incident is a poor time to learn. The sequence takes hours to days.

Maintenance and health checks

  • dcdiag /v per DC and dcdiag /e /q for all, quiet (only failures). Review repadmin /replsummary regularly (replication).
  • Monitor free disk space on the ntds.dit and log volumes. Offline defragmentation (ntdsutil > files > compact to) is rarely needed because the database defragments online every 12 hours; it only shrinks the file after large deletions.
  • Metadata cleanup when a DC dies without demotion: ntdsutil > metadata cleanup or ADUC (delete the computer object of the DC, which cleans the metadata automatically on modern servers), then clean DNS records and AD Sites and Services.
  • DNS scavenging to remove stale records; avoid stale DC records, which cause failed lookups.
  • Time sync, patching and certificate expiry on DCs; keep a documented patch order (test DC first).
  • Review LostAndFound, FSMO placement, schema version (Get-ADObject (Get-ADRootDSE).schemaNamingContext -Property objectVersion) and functional levels regularly.
  • Document everything: DC list, roles, sites, IPs, DSRM password location and recovery runbooks.
Python Recovery decision helper

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Why is replication not a replacement for backup?

    Replication copies mistakes and malicious changes, so you need an independent, older copy.
  2. 2. What is the default tombstone lifetime in a current forest?

    Backups older than 180 days cannot safely be restored because tombstones have been purged elsewhere.
  3. 3. Which method undoes a single accidental user deletion with the least effort when the Recycle Bin is on?

    The Recycle Bin preserves all attributes and allows online restoration.
  4. 4. What does an authoritative restore do?

    ntdsutil increments version numbers so the restored objects win replication conflicts.
  5. 5. What must be done after a full forest recovery?

    Attackers may hold krbtgt and other secrets, so the secrets that could still be abused must be rotated.

Summary

  • Back up System State of at least two DCs per domain, keep copies offline and test restores.
  • Backups and DCs older than the tombstone lifetime (180 days) are unusable.
  • Enable the Recycle Bin for easy object restore; use authoritative restore in DSRM when it is off.
  • Rehearse forest recovery, document DSRM passwords and keep up with dcdiag, replication, DNS and patching.

Next: Project: Design an OU Structure and Delegation Model