Skip to main content
RunBook Academy

Proxmox VEXXVI · Windows GuestsWindows in production

Domain controllers as virtual machines

Expert⏱ ~40 minqmrepadminWindows Server Backup

What you'll learn

  • Explain what vmgenid is on the Proxmox side and what Active Directory does with it
  • Describe USN rollback, what virtualization safeguards prevent, and what they explicitly do not
  • State why a vzdump restore of a domain controller is outside VM-GenerationID semantics
  • Design a backup and recovery strategy for AD that does not depend on hypervisor restore
  • Place domain controllers across hosts and configure the time hierarchy correctly

Prerequisites

Verified against Proxmox VE 9.2.4 · Proxmox Backup Server 4.2.5 · Ceph Squid / Tentacle · Debian 13 (Trixie) · Linux kernel 7.0 (PVE 9.2 default) · 2026-08-12

Not yet marked complete on this device.

Everything the hypervisor is good at — snapshot before a change, roll back if it goes wrong, restore last night’s backup when something is broken — is wrong for a domain controller. Not discouraged. Wrong, in a way that can turn a single-server problem into a forest-wide one, and in a way that Microsoft documents explicitly enough that “we did not know” is not available afterwards.

Active Directory is a multi-master replicated database. Every domain controller is a writable copy that reconciles with the others by exchanging change sequences, and the entire reconciliation protocol depends on one assumption: a change sequence number, once issued by a DC, is never issued again by that DC. A hypervisor rollback breaks exactly that assumption, and it breaks it silently.

This lesson is about what protects you, what does not, and which of those two categories the operation you are about to perform falls into.

USN rollback, in the shape it actually occurs

Microsoft’s own walkthrough of the mechanism is the clearest available, and it is worth following once rather than summarising:

At T1, a snapshot is taken of DC1. DC1 has a highest committed USN of 100 and an invocation ID of A.

At T2, 100 users are created on DC1. Each consumes a USN, so DC1 moves to 200. These replicate to DC2, which records its high watermark as: everything from DC1, in the context of invocation ID A, through USN 200.

At T3, the snapshot from T1 is applied to DC1. Its USN rolls back to 100. It now believes the next update it makes should be USN 101.

Now consider what happens with no protection. DC1 creates a new user and assigns it USN 101, in the context of invocation ID A. DC2 already believes it has everything from DC1 up to USN 200 under invocation ID A, so it does not ask for it. The object exists on DC1 and does not exist on DC2, and neither machine has any reason to think anything is wrong. Multiply that by every change made on DC1 between USN 101 and 200 and you have a permanently divergent directory — a USN bubble — that replication will never repair because replication does not believe there is anything to repair.

That is USN rollback. It does not announce itself, and its symptoms — a user that exists when you authenticate against one DC and not another, a group membership that works in one office — arrive weeks later and look like anything except a restore that was performed in a hurry.

What vmgenid does about it

The protection is a value the hypervisor exposes to the guest. On the Proxmox side it is a first-class VM option, documented tersely:

--vmgenid <UUID> — Set VM Generation ID. Use 1 to autogenerate on create or update, pass 0 to disable explicitly.

Proxmox VE generates one automatically for new VMs and stores it in the VM configuration, and it is designed to change on the events that constitute a time shift for the guest — snapshot rollback, backup restore, and cloning a whole VM.

On the Active Directory side, the behaviour is precise:

AD DS relies on the hypervisor platform to expose an identifier called VM-Generation ID to detect the snapshot restore of a virtual machine. AD DS initially stores the value of this identifier in its database (NTDS.DIT) during domain controller promotion. When an administrator restores the virtual machine from a previous snapshot, the current value of the VM-Generation ID from the virtual machine is compared against the value in the database. If the two values are different, the domain controller resets the Invocation ID and discards the RID pool, thereby preventing USN reuse or the potential creation of duplicate security-principals.

Return to T3 with that in place. DC1 comes up, notices that the generation ID from the hypervisor no longer matches the one in its database, and does two things before committing anything. It resets its invocation ID from A to B, and it discards its RID pool.

The invocation ID reset is the repair. DC1 now issues USNs 101 onward under invocation ID B, about which DC2 knows nothing, so DC2 requests all of it. And because DC2 still holds the changes DC1 made between USN 101 and 200 under invocation ID A, those replicate back into DC1. The directory converges.

Discarding the RID pool is the second repair, addressing a different hazard: a rolled-back DC would otherwise hand out relative identifiers it had already issued, producing two security principals with the same SID.

What the safeguards explicitly do not cover

Here is the part that matters most on Proxmox, and it is the part that people who have read about vmgenid usually have not read.

Microsoft lists two restore methods that virtualized domain controllers do not support safe restore for:

  • VHD and VHDX files manually copied over existing VHD files
  • VHD and VHDX files restored using file backup or full disk backup software

Neither of these operations is covered under VM-GenerationID semantics and therefore don’t change the VM-Generation ID. Restoring domain controllers using these methods could either result in a USN rollback and either quarantine the domain controller or introduce lingering objects and the need for forest wide cleanup operations.

Even when it works, it is not a recovery strategy

The safeguards are a seatbelt, not a reason to drive into walls. Microsoft is unusually direct about their scope:

Virtualized domain controller safe restore is not a replacement for system state backups and the AD DS Recycle Bin.

After restoring a snapshot, the deltas of previously un-replicated changes originating from that domain controller after the snapshot are permanently lost. Safe restore implements automated non-authoritative restoration to prevent accidental domain controller quarantine only.

Read the last four words again. The feature exists to stop a rolled-back DC from poisoning the directory. It does not bring back what was on it.

And it comes with requirements that are easy to violate during an incident, which is precisely when they will be violated:

  • A restored domain controller must be able to contact a writable DC
  • All domain controllers in a domain must not be restored simultaneously
  • Any changes originating from a restored domain controller that have not yet replicated outbound since the snapshot was taken are lost forever

The middle one is the incident-shaped failure. If a storage problem takes out several DCs and someone restores all of them from backups, Active Directory replication will recover but SYSVOL replication halts: every DC marks itself non-authoritative and then looks for an authoritative partner, and there is not one. Group Policy and logon scripts stop being served domain-wide, and the recovery is a manual authoritative-sync procedure on one DC.

What a DC backup strategy looks like instead

You still need backups. You need different ones, and you need to be clear about what each is for.

BackupWhat it is forWhat it is not for
System state backup inside the guest, taken with Windows Server Backup or an AD-aware productAuthoritative restore of deleted objects; forest recovery; the supported AD recovery pathRoutine “put the server back”
AD Recycle BinRecovering deleted objects without any restore at allAnything structural
vzdump/PBS backup of the DC VMRebuilding the machine after a disaster in which the whole site is gone and there is no surviving DC to replicate fromFixing one broken DC in a healthy domain
Additional domain controllersEverything elseNothing; this is the primary mechanism

The distinction that resolves most arguments: a healthy domain repairs a broken DC by replication, not by restore. Hypervisor backups of DCs exist for the case where there is nothing left to replicate from, and in that case you are running a forest recovery procedure, not a VM restore.

If you do take hypervisor backups of DCs, take them properly. The guest agent is what makes the difference:

Configuration changeensure a DC guest is backed up with a quiesced filesystem
VMID=120

qm set "$VMID" --agent enabled=1
qm agent "$VMID" ping && echo "agent responding"

# fsfreeze-status should report thawed on a healthy guest
qm agent "$VMID" fsfreeze-status

The Proxmox guest agent documentation gives the purpose directly: the agent exists to shut the guest down properly rather than relying on ACPI, and “To freeze the guest file system when making a backup/snapshot” — using VSS on Windows. A vzdump of a Windows DC without a working agent is a crash-consistent image of a database mid-write. It may restore. It is not a thing to plan around.

Time

Active Directory authentication is Kerberos, and Kerberos rejects tickets whose timestamps fall outside a tolerance window — five minutes by default. A domain controller with a wrong clock does not degrade; it stops authenticating, and the error messages point everywhere except at the clock.

The Windows Time Service hierarchy has one shape and it is not negotiable:

  1. The PDC emulator of the forest root domain is the authoritative source for the forest. It should be configured to synchronise with an external time source — your network’s NTP servers, or an internet pool.
  2. Every other DC synchronises from a DC higher in the hierarchy. Microsoft describes the default behaviour of a DC forcing “NT5DS (Windows NTP) time synchronization with another domain controller (in a default Windows Time Service hierarchy, this means using the PDCE)”.
  3. Domain members synchronise from a DC.

The virtualisation-specific rule follows from that: a domain-joined guest must not have a second time source competing with the domain hierarchy. On hypervisors that inject host time into the guest, that injection has to be disabled on DCs. On KVM there is no always-on host time injection to disable, which removes the classic version of this problem — but three Proxmox-specific points remain:

  • localtime is on by default for a Windows ostype, and off for everything else. A Windows DC created with ostype: other (Lesson 1) has a hardware clock in UTC and a wall clock offset by your timezone. Kerberos will notice.
  • A guest that has been paused, suspended or migrated may resume with a stale clock. It will correct itself against the hierarchy, but the interval before it does is an interval in which authentication may fail. Watch for it after maintenance.
  • The PDC emulator’s external source has to actually work. If it is unreachable, the whole forest drifts together, which is worse than one machine drifting, because nothing looks inconsistent internally until something external — a certificate, a federated login, a backup system — disagrees.
Read-only / Safeverify the time hierarchy from inside a DC
PS C:\> w32tm /query /status ; w32tm /query /source ; w32tm /monitor
Leap Indicator: 0(no warning)
Stratum: 3 (secondary reference - syncd by (S)NTP)
Precision: -23 (119.209ns per tick)
Source: dc01.example.com
Poll Interval: 10 (1024s)

dc01.example.com[192.0.2.10:123]:
  ICMP: 0ms delay
  NTP: +0.0011870s offset from local clock
dc02.example.com[192.0.2.11:123]:
  ICMP: 1ms delay
  NTP: -0.0004410s offset from local clock

Illustrative output

An offset in the low milliseconds is healthy. An offset in the tens of seconds is an incident that has not started yet.

Key takeaways

  • USN rollback happens because replication tracks (invocation ID, USN) pairs and a rolled-back DC reissues numbers a partner believes it already has. The divergence is permanent and silent.
  • vmgenid is a Proxmox VM option — 1 to autogenerate, 0 to disable — that AD compares against a value in its database. A mismatch triggers an invocation ID reset and a RID pool discard.
  • Microsoft explicitly excludes disks restored by full disk backup software from VM-GenerationID semantics. Verify what your restore path does to vmgenid, in a lab, before you need to know.
  • Safeguards prevent quarantine only. Un-replicated changes originating on the restored DC are lost forever, and the feature is explicitly not a replacement for system state backups or the AD Recycle Bin.
  • A healthy domain repairs a broken DC by replication. Remove and rebuild beats restore, which is why two DCs is a minimum rather than a nicety.
  • Never restore all DCs at once — SYSVOL replication halts — and never run them all on one hypervisor host.
  • Kerberos has a five-minute default tolerance. The forest root PDC emulator syncs externally; everything else syncs down the hierarchy; nothing competes.

Knowledge check

Knowledge check · 4 questions

  1. Q1. It is 22:00 and a domain controller in a two-DC domain has a failed update. A colleague proposes restoring last night vzdump backup of the VM. What is the strongest objection?

  2. Q2. A snapshot rollback of a DC triggers virtualization safeguards correctly: the invocation ID is reset and the RID pool discarded. What have you actually been protected from, and what have you still lost?

  3. Q3. Which of these are documented requirements or constraints for virtualization safeguards to work as intended? Select all that apply.

  4. Q4. Adding a vmgenid to an existing domain controller VM that does not have one will trigger virtualization safeguards at the next boot, and this is expected behaviour rather than a fault.

Passing score: 75%. Answers are checked in this browser.