Active Directory Troubleshooting Cheat Sheet

Start here

Is the whole domain healthy?
dcdiag /v
Is replication working?
repadmin /replsummary
Which DC am I talking to?
nltest /dsgetdc:corp.local
Is the clock right?
w32tm /query /status
Did I get a Kerberos ticket?
klist
Is the machine account intact?
nltest /sc_verify:corp.local
Order matters. Time, then secure channel, then replication, then the service itself. Kerberos sits under all of it, so a clock five minutes out makes every other test lie.

Domain controller discovery

TaskCommand
Which DC serves this machinenltest /dsgetdc:corp.local
Force a fresh discovery, ignore the cachenltest /dsgetdc:corp.local /force
All DCs in the domainnltest /dclist:corp.local
Which AD site this machine is innltest /dsgetsite
All trusts of this domainnltest /domain_trusts /v
Find the PDC emulatornetdom query fsmo
Domain and forest functional levelGet-ADDomain | Select-Object DomainMode

Secure channel and machine account

TaskCommand
Query the secure channelnltest /sc_query:corp.local
Verify it end to endnltest /sc_verify:corp.local
Reset it without rejoiningnltest /sc_reset:corp.local
PowerShell test, returns True or FalseTest-ComputerSecureChannel
PowerShell repair, needs credentialsTest-ComputerSecureChannel -Repair -Credential (Get-Credential)
Reset the machine account passwordReset-ComputerMachinePassword -Server SRV-DC01
Do not rejoin first. A rejoin creates a new SID relationship and loses group memberships assigned to the computer object. Try nltest /sc_reset or Test-ComputerSecureChannel -Repair before removing anything from the domain.

Replication

TaskCommand
Forest-wide summary, worst firstrepadmin /replsummary /bysrc /bydest /sort:delta
Only the failing connectionsrepadmin /showrepl * /errorsonly
Everything, as CSVrepadmin /showrepl * /csv
Push changes out from one DCrepadmin /syncall SRV-DC01 /AdeP
Replicate one partition, one pairrepadmin /replicate SRV-DC02 SRV-DC01 dc=corp,dc=local
What a DC still has to fetchrepadmin /queue SRV-DC02
Who last changed an attributerepadmin /showobjmeta SRV-DC01 "CN=svc-backup,OU=Service Accounts,DC=corp,DC=local"
Recalculate the topologyrepadmin /kcc
PowerShell, all failures in the forestGet-ADReplicationFailure -Target corp.local -Scope Forest

Health tests

TaskCommand
Everything, verbosedcdiag /v
One named DCdcdiag /s:SRV-DC01
Every DC in the enterprisedcdiag /e
Replication onlydcdiag /test:Replications /v
DNS, the full suitedcdiag /test:DNS /e /v
Is the DC advertising its rolesdcdiag /test:Advertising
Netlogon share and permissionsdcdiag /test:NetLogons
Save the output for the ticketdcdiag /v /f:C:\logs\dcdiag.txt

Time synchronisation

TaskCommand
Source, stratum, last successful syncw32tm /query /status
Just the sourcew32tm /query /source
Effective settings and where they came fromw32tm /query /configuration
Offset of every DC in the domainw32tm /monitor
Sample the offset against one hostw32tm /stripchart /computer:SRV-DC01 /samples:10 /dataonly
Resync now, rediscovering the sourcew32tm /resync /rediscover
PDC emulator, external sourcew32tm /config /manualpeerlist:"0.pool.ntp.org,0x9" /syncfromflags:manual /reliable:yes /update
Member server, back to the hierarchyw32tm /config /manualpeerlist:"" /syncfromflags:domhier /update
Source: Local CMOS Clock means the machine is not synchronising with anything. The service is running, nothing is logged, and the clock drifts until Kerberos refuses tickets.

Kerberos tickets

TaskCommand
Tickets in this sessionklist
The TGT on its ownklist tgt
Discard them, pick up new group membershipklist purge
All logon sessions with their LUIDsklist sessions
The SYSTEM session, used by servicesklist -li 0x3e7 tickets
Purge the SYSTEM sessionklist -li 0x3e7 purge
Request a ticket for one SPNklist get HTTP/app.corp.local
Which DC Kerberos is usingklist query_bind
Groups in the current tokenwhoami /groups

Service principal names

TaskCommand
List SPNs on an accountsetspn -L svc-web
Find which account owns an SPNsetspn -Q HTTP/app.corp.local
Find duplicates across the forestsetspn -X -F
Add an SPN with a duplicate checksetspn -S HTTP/app.corp.local svc-web
Remove an SPNsetspn -D HTTP/app.corp.local svc-web
Always use -S, never -A. -S refuses to create a duplicate. A duplicate SPN breaks Kerberos for both accounts and is invisible until someone runs setspn -X.

Querying the directory

TaskCommand
Find a user by namedsquery user -name "John*"
Accounts inactive for 4 weeksdsquery user -inactive 4
Members of a groupdsget group "CN=FileAdmins,OU=Groups,DC=corp,DC=local" -members
Groups a user belongs todsquery user -samid jsmith | dsget user -memberof -expand
Disabled computer accountsdsquery computer -disabled
PowerShell equivalentGet-ADUser -Filter 'Enabled -eq $false' -Properties LastLogonDate

Error codes worth recognising

CodeMeaningWhere to look first
1256The remote system is not availableNetwork path to the partner DC
1722The RPC server is unavailableFirewall, RPC ports, name resolution
1908Could not find the domain controllerDNS, site configuration
8453Replication access was deniedPermissions, and clock skew via Kerberos
8524DSA operation failed on a DNS lookupThe CNAME under _msdcs
8606Insufficient attributes to create an objectLingering objects on a long-disconnected DC

FAQ

A user was added to a group and still cannot access the share. What now?
Group membership travels inside the Kerberos ticket, and the ticket was issued at logon. Run klist purge in the user’s session and reconnect, or have them log off and back on. If it still fails, the change may not have replicated to the DC that authenticates them: check with repadmin /showrepl * /errorsonly.
Which do I run first, dcdiag or repadmin?
dcdiag tells you which component failed. repadmin tells you which link, which partition and which error code. Start with repadmin /replsummary when the symptom is inconsistent data between sites, and with dcdiag /v when a domain controller itself is misbehaving.
How much clock skew does Kerberos tolerate?
Five minutes by default, set by the maximum tolerance for computer clock synchronisation in the Default Domain Policy. Past that, tickets are refused and the symptom looks like a permissions problem. w32tm /monitor shows the offset of every DC in one command.
Is it safe to force replication during the working day?
repadmin /syncall /AdeP pushes only the changes that have not replicated yet, so on a healthy domain it is cheap. It is not safe on a DC that has been disconnected longer than the tombstone lifetime, which is 180 days on any forest built on Windows Server 2003 SP1 or later. That DC should be demoted and rebuilt, not synchronised.
The secure channel is broken. Rejoin the domain?
Not first. nltest /sc_reset:corp.local or Test-ComputerSecureChannel -Repair fixes it in place and keeps the existing computer object, its SID and any group memberships attached to it. Rejoining discards all of that.
Which of these need Domain Admin?
Reading is mostly available to any authenticated user: klist, w32tm /query, nltest /dsgetdc, dsquery. Writing and most of repadmin and dcdiag need Domain Admins or delegated rights, and everything on a domain controller needs an elevated prompt.