How to demote a domain controller

Demoting a domain controller is usually straightforward. The part that deserves most of your attention happens before you click Demote. A DC may be doing much more than authenticating users and replicating Active Directory. It might also be providing DNS, holding FSMO roles, acting as a Global Catalog, running NPS or DHCP, hosting file shares, running certificate services, or supporting an application somebody configured years ago and forgot about.

A clean demotion removes the server from Active Directory properly and lets the remaining DCs take over its directory responsibilities. A forced removal is different: it’s a recovery procedure, not the normal way to decommission a DC. The workflow looks like this:

  1. Find out what the DC is responsible for.
  2. Make sure another DC can provide those services.
  3. Check Active Directory and replication health.
  4. Move FSMO roles if necessary.
  5. Fix DNS and time dependencies.
  6. Demote the DC normally.
  7. Verify AD, DNS and client authentication afterwards.
  8. Only run metadata cleanup if the normal demotion didn’t complete.

Find out what the server actually does

Before checking replication or moving FSMO roles, establish what the server is doing. At a minimum, look for:

  • Active Directory Domain Services, DNS Server and Global Catalog
  • FSMO roles
  • DHCP and NPS/RADIUS
  • Active Directory Certificate Services
  • file and print services
  • Microsoft Entra Connect Sync
  • scheduled tasks and scripts
  • backup and monitoring agents
  • any application with the server’s name or IP configured

This matters most in older environments, because a server that started life as a DC tends to accumulate other roles. Demoting a DC doesn’t move DHCP, NPS, file shares or certificate services anywhere. Those have to be migrated separately.

Check the installed roles and the DC’s own attributes:

powershell

Get-WindowsFeature | Where-Object Installed

Get-ADDomainController -Identity "DC01" |
    Select-Object HostName,Site,IsGlobalCatalog,OperationMasterRoles

Then see what’s listening, with process names resolved:

powershell

Get-NetTCPConnection -State Listen |
    Select-Object LocalAddress, LocalPort,
        @{N='Process';E={(Get-Process -Id $_.OwningProcess).ProcessName}} |
    Sort-Object LocalPort

Without that calculated property you just get process IDs, which tell you very little. From an elevated command prompt, netstat -abno gives the same picture with executable names. The point isn’t to remove every service you find. It’s to know what disappears when the server does.

Find out who is actually using it for LDAP

“Applications using LDAP” appears on every decommissioning checklist, and it’s the item people guess at. There are better options than guessing, but it’s worth knowing what each one shows.

Insecure binds: LDAP interface events

Setting LDAP interface events logging to level 2 on the DC makes it log event 2889 for every client that performs an unsigned SASL bind or a clear-text simple bind, with the client’s IP address and the account used:

powershell

Set-ItemProperty `
    -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics" `
    -Name "16 LDAP Interface Events" -Value 2

Event 2887 is a daily summary that counts those binds, but doesn’t name the clients. This is the right way to find the older applications and appliances doing insecure binds, which are often the ones hard-coded to a particular DC. It won’t show clients that bind securely, so on its own it isn’t a complete list of who uses the server. Set the value back to 0 when you’re finished, because the logging is noisy.

Every client: record who connects

For a full picture, record which hosts hold connections to the DC’s LDAP and Global Catalog ports. Run this on a schedule, every 15 minutes or so, and keep the output:

powershell

Get-NetTCPConnection -State Established -LocalPort 389,636,3268,3269 |
    Select-Object @{N='Time';E={Get-Date}}, RemoteAddress, LocalPort |
    Export-Csv C:\Temp\ldap-clients.csv -Append -NoTypeInformation

Leave either method running for a week or two, long enough to catch weekly and monthly jobs as well as daily ones. A backup job that only runs on the first Sunday of the month won’t appear in three days of logging. Either way, you get evidence of which clients actually connect to this DC, rather than a list of the ones you remember configuring.

Check Active Directory health first

Don’t use a demotion to try to clean up an already unhealthy directory:

cmd

repadmin /replsummary
dcdiag /v

Not every line of dcdiag needs to be perfect, but understand any replication failures, DNS problems or unexplained errors before removing a DC. Troubleshooting a two-DC environment is much easier than discovering after the demotion that your remaining DC wasn’t replicating properly. Then check what AD currently knows about:

powershell

Get-ADDomainController -Filter * |
    Select-Object HostName,Site,IPv4Address,IsGlobalCatalog

If you expected three healthy DCs and the output says otherwise, stop and investigate.

Check FSMO roles

There are five FSMO roles: PDC Emulator, RID Master, Infrastructure Master, Schema Master and Domain Naming Master. Check who holds them:

powershell

Get-ADDomain | Select-Object PDCEmulator,RIDMaster,InfrastructureMaster
Get-ADForest | Select-Object SchemaMaster,DomainNamingMaster

If the DC being removed holds any of these, transfer them first.

-Identity is the destination, not the source

This catches people out. In Move-ADDirectoryServerOperationMasterRole, -Identity is the DC that will receive the role, not the one you’re retiring. So if DC01 is going and DC02 is staying:

powershell

Move-ADDirectoryServerOperationMasterRole -Identity "DC02" `
    -OperationMasterRole PDCEmulator,RIDMaster,InfrastructureMaster,SchemaMaster,DomainNamingMaster

The numeric equivalents, -OperationMasterRole 0,1,2,3,4, also work. Run the two Get-AD... commands again afterwards to confirm the roles moved. Transfer, don’t seize. Seizure is for a DC that’s already gone.

-DemoteOperationMasterRole doesn’t transfer anything

This is worth being explicit about, because the name suggests otherwise. -DemoteOperationMasterRole doesn’t transfer FSMO roles for you. It lets the demotion proceed even though the server still holds them, which means they then have to be seized onto another DC afterwards. That’s a worse position than transferring them cleanly first. It belongs in a forced-removal scenario. For a planned retirement, move the roles first and verify them.

The PDC Emulator and time

If the DC being removed holds the PDC Emulator role, time synchronisation needs attention. The PDC Emulator in the forest root domain is the authoritative time source for the forest unless another reliable source has been configured. After transferring the role, check the Windows Time configuration on the new holder:

cmd

w32tm /query /configuration
w32tm /query /status
w32tm /query /peers

If your environment uses an external NTP source, configure the new PDC to use it. The FSMO role moved, but the old server’s Windows Time configuration didn’t move with it. That’s a common oversight, and the symptom is a forest gradually drifting until Kerberos starts failing.

Check DNS before touching the DC

Check whether the DC runs DNS with Get-WindowsFeature DNS, look at its zones, and make sure another DNS server can answer for the AD-integrated ones.

More importantly, check the DNS client settings on the remaining DCs. If DC02 points at DC01 as its only DNS server, removing DC01 creates an entirely avoidable problem. Run this on every remaining DC, and on any infrastructure that depends on the retiring server for name resolution:

powershell

Get-DnsClientServerAddress -AddressFamily IPv4

Also check DHCP scope options and any statically configured clients, then test the AD DNS configuration with dcdiag /test:DNS /v. If the retiring DC is the only server providing a particular zone, delegation or forwarder, fix that dependency first.

Check Global Catalog coverage

If the DC being removed is a Global Catalog server, make sure another suitable DC provides that service. Use the same Get-ADDomainController -Filter * command with IsGlobalCatalog and Site to check. This matters most in multi-site environments, because the goal isn’t just having another Global Catalog somewhere in the domain. It’s having directory services available where clients and applications actually need them.

Check AD Sites and Services

Open Active Directory Sites and Services and look at the server object, NTDS Settings, replication connections, site membership and the associated subnet. It’s a good opportunity to confirm the remaining DCs are placed in the expected sites too. Don’t start deleting objects manually, though. A successful demotion handles the directory removal itself.

Take a backup

A system state backup before a significant AD change is sensible. It isn’t a substitute for checking the environment first, but it’s a layer of protection if something unexpected happens. If you use a third-party backup platform, confirm you have a usable recovery point, rather than assuming a server shown as “protected” means anything.

Demote the domain controller

Once the dependencies are handled, the demotion itself is the easy part.

Using Server Manager

Go to Manage > Remove Roles and Features, select the local server and clear Active Directory Domain Services. Because the server is a DC, Windows won’t simply remove the binaries, and the wizard offers Demote this domain controller instead.

Read the warnings rather than clicking past them. The wizard identifies DNS, Global Catalog and operations master roles on the server, which is telling you what disappears when the DC goes. You’ll be asked to set a new local Administrator password, because after demotion the server becomes a member server with its own local accounts again. If the server is the last DC in the domain, stop and confirm that’s really what you intend, because that’s an entirely different operation.

Using PowerShell

powershell

Uninstall-ADDSDomainController -Credential (Get-Credential)

Microsoft’s Uninstall-ADDSDomainController documentation covers the full parameter set. Two practical notes:

  • -LocalAdministratorPassword is optional. Leave it out and you’re prompted to set and confirm the password interactively. That’s fine at the console, but a script that leaves it out will stall waiting for input. For automation, read it in first:

powershell

  $pw = Read-Host -AsSecureString -Prompt "New local Administrator password"
  Uninstall-ADDSDomainController -LocalAdministratorPassword $pw -Credential (Get-Credential)
  • -Credential is only needed if you aren’t logged on with sufficient rights. You need Domain Admins to demote a replica DC, and Enterprise Admins to remove the last DC in a domain.

The server restarts as part of the normal process. -NoRebootOnCompletion exists, but Microsoft recommends allowing the restart. For a planned demotion, I wouldn’t add -Force just to make it unattended. Let the validation and confirmation run.

Forced demotion is a different thing

-ForceRemoval is for a DC that can’t contact its replication partners, where there’s no reasonable way to fix that. A forced removal doesn’t replicate the DC’s final directory changes to its partners. It leaves cleanup work behind: seizing FSMO roles, cleaning up DNS, the computer account and Sites and Services, verifying Global Catalog coverage, dealing with application partitions and checking replication. It isn’t a shortcut for a normal retirement.

Verify everything afterwards

Active Directory

Give replication a little time, then run repadmin /replsummary and dcdiag /v again, and list the DCs:

powershell

Get-ADDomainController -Filter * |
    Select-Object HostName,Site,IsGlobalCatalog,OperationMasterRoles

The retired DC should no longer appear, and the FSMO roles should show on the servers you moved them to.

Discovery from a client

This is the check I wouldn’t skip, because it tests the thing users actually depend on. From a domain-joined workstation, ask DC Locator to find a domain controller now:

cmd

nltest /dsgetdc:yourdomain.local

It should return one of the remaining DCs. Don’t rely on echo %LOGONSERVER% for this, because it reflects the DC recorded at logon and can be stale. I’ve covered that distinction in more detail in how to find the domain controller you’re authenticated to. Then refresh Group Policy:

cmd

gpupdate /force

If that completes without errors, the client found a remaining DC, authenticated against it and processed policy from it. A client that does all three is much better evidence than a computer object having disappeared from an OU.

DNS records

After the demotion, look for references to the old server in A, PTR, SRV and CNAME records, delegations and conditional forwarders. Confirm that the remaining DCs use working DNS servers, the AD zones are available, the SRV records point to the right servers and clients can resolve the domain. Don’t blindly delete every record containing the server name, though. Check what each one is for. AD-integrated DNS replicates between the remaining DNS servers, so check more than one if you have multiple sites.

Time, applications and infrastructure

On the new PDC Emulator, run the three w32tm /query commands again and confirm it’s syncing from the intended source. Then confirm DHCP still works, NPS/RADIUS authentication works, LDAP applications still connect, and certificate services remain available. Also check that file shares have been migrated or retired deliberately, monitoring and backup jobs aren’t still targeting the old server, and network devices referencing its IP have been updated.

Finally, don’t reuse the old IP address straight away. Leave it unassigned for a while, so anything still pointed at it fails visibly rather than quietly reaching an unrelated server.

Metadata cleanup isn’t a routine step

If the demotion succeeded, you shouldn’t need ntdsutil and metadata cleanup. That’s a recovery procedure for a DC that was forcibly removed, or that disappeared without a successful demotion. Since Windows Server 2008, deleting the computer object of a permanently offline DC from the Domain Controllers OU in Active Directory Users and Computers performs the metadata cleanup automatically, so manual ntdsutil is rarely needed now. Metadata cleanup modifies Active Directory directly, and it isn’t something to run just because you’ve finished a successful demotion.

Why the sequence matters

Don’t start with the demotion wizard. Start by asking what the server is responsible for, then check AD health, replication, DNS, Global Catalog availability, FSMO roles and time, and move anything else on the machine that needs to survive. Once the dependencies are dealt with, do a normal demotion and let Windows remove the DC cleanly. Then verify from both sides: repadmin and dcdiag on the remaining DCs, and real discovery and authentication from a client.

The distinction worth holding onto is between planned demotion and forced removal. A planned demotion leaves the directory clean. Forced removal is what you reach for when the normal process isn’t possible, and it comes with cleanup attached.

Domain controller demotion checklist

  1. Inventory what the DC does: roles, FSMO roles, Global Catalog, DNS, DHCP, NPS, certificate services, file shares, Entra Connect Sync, scheduled tasks and agents.
  2. Identify LDAP clients over one to two weeks, using event 2889 for insecure binds and connection snapshots for everyone else.
  3. Confirm AD health with repadmin /replsummary and dcdiag /v, and fix anything unexplained.
  4. Transfer the FSMO roles with -Identity set to the destination DC, then verify them.
  5. If the PDC Emulator moved, configure Windows Time on the new holder.
  6. Make sure the remaining DCs, DHCP scopes and static clients don’t point at the retiring DC for DNS.
  7. Confirm Global Catalog coverage in every site that needs it, and that Sites and Services is correct.
  8. Take a system state backup and confirm the recovery point is usable.
  9. Demote normally with Server Manager or Uninstall-ADDSDomainController, without -Force or -ForceRemoval.
  10. Verify replication, FSMO placement and the DC list, then run nltest /dsgetdc and gpupdate /force from a client.
  11. Review leftover DNS records, time sync, DHCP, NPS, LDAP applications, monitoring and backups.
  12. Leave the old IP address unused for a while, and only run metadata cleanup if the demotion didn’t complete.

References

Leave a Reply

Your email address will not be published. Required fields are marked *