Domain Join Sanity Checks: Prove a Windows Server Joined Cleanly

🛠️Part of the Windows Administration Complete Guide, every Windows administration post on this site, grouped by the job you are doing.

After joining a Windows server to a domain, these are the checks I run to prove the join is healthy: the domain and secure channel, finding a domain controller, Group Policy, and the event logs. Each one takes seconds, and together they catch most of what goes wrong after a join, usually a firewall rule nobody opened, DNS pointing at the wrong server, or a clock that has drifted.

Run them in an elevated (administrator) PowerShell or Command Prompt window on the server you just joined. Replace corp.example.com with your own domain name.

Confirm the Server Is on the Domain

Start with the basics, because a join that silently failed and left the server in a workgroup is more common than you would think:

PowerShell
# Is this machine on a domain, and which one?
Get-CimInstance Win32_ComputerSystem | Select-Object Name, PartOfDomain, Domain

PartOfDomain should be True and Domain should be your domain. On a machine that is not joined you get False and WORKGROUP.

Check the Secure Channel

The secure channel is the trust between this computer’s account and the domain. If it is broken, logons and Group Policy fail even though the server still says it is on the domain. In PowerShell:

PowerShell
# True means the computer account and the domain trust each other
Test-ComputerSecureChannel -Verbose

Or with Nltest, which also tells you which domain controller answered:

Command Prompt
rem Change corp.example.com to your domain name
nltest /sc_query:corp.example.com
nltest /sc_verify:corp.example.com
nltest /sc_query reporting the state of the secure channel to the domain

If the channel is broken, Test-ComputerSecureChannel -Repair -Credential (Get-Credential) resets it with a domain account that is allowed to, without having to rejoin the server.

Find a Domain Controller

Nltest is the quickest way to see whether the server can find a domain controller, and which one it picked:

Command Prompt
rem Change corp.example.com to your domain name
nltest /dclist:corp.example.com
nltest /dsgetdc:corp.example.com
nltest /dsgetsite

/dclist lists the domain controllers in the domain:

nltest /dclist listing the domain controllers in the domain

/dsgetdc returns the domain controller this server located, with its address and flags. Add /force to make it look again instead of using a cached answer, which is useful after a DNS or firewall fix:

nltest /dsgetdc returning the located domain controller and its IP address

/dsgetsite returns the Active Directory site the server thinks it is in. A server in the wrong site works, but it may authenticate against a domain controller in another building or another country:

nltest /dsgetsite returning the Active Directory site name

When It Cannot Find One: DNS, Ports and Time

If Nltest cannot find a domain controller, it is nearly always DNS. Domain controllers are found through SRV records, so check that the server’s DNS can see them:

PowerShell
# Change these two to your domain and one of your domain controllers
$Domain = 'corp.example.com'
$DC     = 'dc01.corp.example.com'

# Domain controllers are found through these SRV records
Resolve-DnsName -Type SRV "_ldap._tcp.dc._msdcs.$Domain"

# Then test the ports a domain member needs to reach a DC
Test-NetConnection $DC -Port 389   # LDAP
Test-NetConnection $DC -Port 88    # Kerberos
Test-NetConnection $DC -Port 445   # SMB, for Group Policy files
Test-NetConnection $DC -Port 135   # RPC endpoint mapper

Any domain controller name from the nltest /dclist output above will do for $DC.

If the SRV lookup fails, the server is usually pointed at a DNS server that is not the domain’s, such as a public resolver. If the ports fail, that is the firewall request for the network team. If the domain controller is yours, check its Windows Firewall profiles first. The full list of ports is longer than these 4 (RPC also uses a dynamic range), but these 4 are the ones to test first.

Then check the clock. Kerberos refuses logons when the server and the domain controller are more than 5 minutes apart by default, and the error messages do not say “your clock is wrong”:

Command Prompt
w32tm /query /status
w32tm /query /source

After a join, the source should be a domain controller (or the domain hierarchy), not Local CMOS Clock.

Apply and Check Group Policy

Group Policy is the first thing that uses the new membership in earnest, so it is a good end-to-end test. Force an update:

Command Prompt
gpupdate /force
gpupdate completing the computer and user policy update on Windows Server

Then look at what was actually applied. /r gives a summary, /v the verbose version, and /h writes an HTML report that is much easier to read:

Command Prompt
gpresult /r /scope computer

rem HTML report into your temp folder (/f overwrites an older one), then open it
gpresult /h %TEMP%\gpresult.html /f
start %TEMP%\gpresult.html
gpresult /v output listing the computer policies applied to the server

If you expected a policy and it is not listed, check which OU the computer account landed in. New computer accounts go to the default Computers container unless someone moved them or pre-staged the account, and policies linked to an OU do not apply there.

Read the Event Logs

Not every warning in Event Viewer needs investigating, but errors during and just after the join usually point at the cause. These are the ones worth looking for:

  • NETLOGON 5719 (System log): the computer could not set up a secure session with a domain controller. Usually DNS or the network.
  • NETLOGON 3210 (System log): the computer could not authenticate with a domain controller. Usually a broken secure channel or a duplicate computer name.
  • GroupPolicy 1129 (System log): Group Policy failed because there was no network connectivity to a domain controller.

Rather than scrolling through Event Viewer, filter for Netlogon errors and warnings from the last day:

PowerShell
# Netlogon errors (2) and warnings (3) from the last day
# Change AddDays(-1) to look further back, e.g. AddDays(-7)
Get-WinEvent -FilterHashtable @{
    LogName      = 'System'
    ProviderName = 'NETLOGON'
    Level        = 2, 3
    StartTime    = (Get-Date).AddDays(-1)
} | Select-Object TimeCreated, Id, Message

“No events were found” is the answer you want. The Group Policy detail lives in its own log, Applications and Services Logs > Microsoft > Windows > GroupPolicy > Operational:

Windows Event Viewer showing the System log on the newly joined server

If the join itself failed with the DNS name error, that one has its own post: “Changing the Primary Domain DNS Name of This Computer Failed”.


Related

If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.

Comments

Leave a Reply

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