Join computers to the domain and add a second DC
-
Phase 0: Before you start
-
Phase 1: The foundation
-
Phase 2: Core administration and security
-
Phase 3: Enterprise infrastructure
-
Phase 4: Troubleshooting step by step
-
Phase 5: Final project and career
A domain with one server in it isn’t much use. The real work starts when you join computer to domain: servers and laptops become members, people sign in with their AD accounts, and Group Policy can reach every machine.
In this lesson you’ll join SRV01 and a new Windows 11 client, CL01, to saatlab.internal. Then you’ll build DC02 on Server Core, promote it from DC01 without touching its console, and prove the two DCs replicate.
| Time | You need | By the end you can |
|---|---|---|
| About 2 hours (most of it is installs) | DC01 promoted (Lesson 11), the users from Lesson 12, SRV01 configured (Lesson 6), and the CL01 and DC02 VMs from Lesson 2 | Join a server and a client to the domain, move computer objects into the right OU, repair a broken trust, add a second DC and check replication |
What it is, in one line
To join computer to domain means creating an account for the computer in Active Directory and giving it a shared secret, so the computer and the DCs trust each other from then on.
In Simple Words
Joining a company, not just walking in
A visitor can walk into an office building, but they can’t open any doors. A new employee gets an ID card from the security desk. From then on, every door reader recognises them, and HR can change what their card opens without touching the card.
Joining a computer to the domain is giving it that ID card. The DC is the security desk. Once joined, the computer is recognised everywhere in the company, and you can control it centrally.
A second DC is a second security desk at the other entrance. If one desk closes for the day, people still get in, and both desks share the same staff list.
Engineer's View
Computer accounts, the secure channel and a second DC
Computer accounts: each member has an AD object (sAMAccountName CL01$) with its own password. The computer changes that password itself every 30 days by default. The secure channel is the Netlogon connection the member builds with a DC using that password.
Finding a DC: the DC locator asks DNS for SRV records such as _ldap._tcp.dc._msdcs.saatlab.internal. If the computer’s DNS points at a public resolver, the join fails before any credentials are checked. This is why members must use only internal DNS.
Who can join: by default any authenticated user can join up to 10 computers (ms-DS-MachineAccountQuota). In production, set it to 0 and either pre-create (pre-stage) computer accounts or delegate the join right on a specific OU. New computers land in CN=Computers unless you use -OUPath, pre-stage them or redirect the default with redircmp.
A second DC: AD is multi-master, so every writable DC accepts changes and replicates them using update sequence numbers (USNs). Within one site, changes go out about 15 seconds after they’re made. DC02 runs Server Core: no desktop, a smaller attack surface and fewer updates, managed over PowerShell remoting (WinRM, TCP 5985).
How it works, step by step
When you run the join, a lot happens in a few seconds. The computer has to find a DC, prove you’re allowed to add it, create its account and agree a password:
The last step matters most. From now on, the computer and AD both know the computer’s password. If the copy in AD and the copy on the computer stop matching, you get the famous “trust relationship failed” error, which you’ll cause on purpose later.
By the end of the lab, the domain looks like this. Two DCs share the directory and DNS, and every member uses them for name resolution:
- SRV01 first: point its DNS at DC01, then join it with PowerShell straight into the Servers OU.
- CL01 next: install Windows 11, give it a temporary fixed address, and join it through the Settings app the way a helpdesk would.
- DC02 last: install Server Core, set its address, join it, then promote it remotely from DC01.
- Check: list the DCs, create a user on one DC and read it from the other, and run
repadmin /replsummary.
Your laptop’s memory sets the order. With 8 GB, run DC01 plus one other VM at a time, as planned in Lesson 2.
Hands-on Lab: join computer to domain and add DC02
Start DC01 and SRV01. On SRV01, sign in as the local Administrator (it isn’t in the domain yet). Use PowerShell as administrator everywhere in this lab.
1Point SRV01 at DC01 for DNS
In Lesson 6, SRV01 used 1.1.1.1 so it could get updates. A domain member must use only your DCs for DNS, so change it now and test that it can find a DC:
On SRV01, run this:
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.0.10
Resolve-DnsName -Type SRV _ldap._tcp.dc._msdcs.saatlab.internal | Select-Object Name, NameTarget, PortYou should see something like this:
Name NameTarget Port
---- ---------- ----
_ldap._tcp.dc._msdcs.saatlab.internal DC01.saatlab.internal 389This is the same lookup the join does first. If it fails here, the join will fail too, so always test DNS before you join.
✅ Checkpoint: Resolve-DnsName returns DC01.saatlab.internal on port 389.
2Join SRV01 straight into the Servers OU
On SRV01, run this. Type the SAATLAB\Administrator password when asked:
Add-Computer -DomainName saatlab.internal -OUPath 'OU=Servers,OU=SAATLAB,DC=saatlab,DC=internal' -Credential SAATLAB\Administrator -RestartSRV01 restarts. On the sign-in screen, choose Other user and sign in as SAATLAB\Administrator. The domain prefix tells Windows to check the password with a DC instead of the local account list.
Then check the membership:
Get-CimInstance Win32_ComputerSystem | Select-Object Name, Domain, PartOfDomain
Test-ComputerSecureChannelYou should see something like this:
Name Domain PartOfDomain
---- ------ ------------
SRV01 saatlab.internal True
TrueTest-ComputerSecureChannel returning True means SRV01’s password matches its account in AD. You’ll make it return False on purpose in Break It.
✅ Checkpoint: SRV01 shows PartOfDomain True and the secure channel test returns True.
3Install the AD tools on SRV01, not the role
In Lesson 10 you saw that AD cmdlets don’t exist on SRV01. Install only the management tools, then look at the computer objects from SRV01:
On SRV01, run this:
Install-WindowsFeature RSAT-AD-PowerShell, RSAT-ADDS
Get-ADComputer -Filter * | Select-Object Name, DistinguishedNameYou should see something like this:
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No Success {Active Directory module for Windows Power...
Name DistinguishedName
---- -----------------
DC01 CN=DC01,OU=Domain Controllers,DC=saatlab,DC=internal
SRV01 CN=SRV01,OU=Servers,OU=SAATLAB,DC=saatlab,DC=internalSRV01 landed in the Servers OU because you gave -OUPath. Admins usually manage AD from a member server or their own PC like this, not by signing in to a DC.
✅ Checkpoint: Get-ADComputer works on SRV01 and shows SRV01 inside OU=Servers.
4Install Windows 11 on CL01
Shut down SRV01 to make room in memory. On your laptop, run VBoxManage startvm CL01. CL01 was created in Lesson 2 with the Windows 11 type, so it already has UEFI, Secure Boot and TPM 2.0, which Windows 11 needs.
Choose Windows 11 Enterprise Evaluation and install to the 80 GB disk. During setup, when it asks you to sign in with a Microsoft account, choose Sign-in options, then Domain join instead, and create a local account called labadmin.
When the desktop appears, install Guest Additions (Devices menu) as you did on the servers, and restart. CL01 has no network address yet because LabNet has no DHCP; you’ll add a DHCP server in Lesson 15.
Until then, give it a fixed address. In PowerShell as administrator on CL01:
New-NetIPAddress -InterfaceAlias Ethernet -IPAddress 10.0.0.100 -PrefixLength 24 -DefaultGateway 10.0.0.1 | Out-Null
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.0.10
Rename-Computer -NewName CL01 -Restart✅ Checkpoint: CL01 restarts with the name CL01, address 10.0.0.100 and DNS 10.0.0.10.
5Join CL01 the helpdesk way, then move it
On CL01, open Settings, System, About and click Domain or workgroup. In the System Properties window, click Change, choose Domain, type saatlab.internal and click OK.
Enter SAATLAB\Administrator and its password. You’ll see “Welcome to the saatlab.internal domain.” Click OK and restart.
The Settings app has no box for the OU, so CL01 landed in the default Computers container. Move it from DC01:
On DC01, run this:
Get-ADComputer CL01 | Move-ADObject -TargetPath 'OU=Workstations,OU=SAATLAB,DC=saatlab,DC=internal'
Get-ADComputer CL01 | Select-Object Name, DistinguishedNameYou should see something like this:
Name DistinguishedName
---- -----------------
CL01 CN=CL01,OU=Workstations,OU=SAATLAB,DC=saatlab,DC=internalNow sign in to CL01 as a normal user: choose Other user and type SAATLAB\priya.sharma with the password from Lesson 12. If that account has “change password at next logon” set, Windows asks for a new one.
In a normal PowerShell window on CL01, run this:
whoami
$env:LOGONSERVERYou should see something like this:
saatlab\priya.sharma
\\DC01✅ Checkpoint: Priya signed in to CL01, and LOGONSERVER shows \\DC01.
6Install DC02 on Server Core and join it
Shut down CL01. Start DC02 from your laptop with VBoxManage startvm DC02. In Setup, choose Windows Server 2025 Datacenter Evaluation, the image without “(Desktop Experience)”.
After the install, set the Administrator password and sign in.
There’s no desktop: just a text window with sconfig. Choose 15 to exit to PowerShell. This is the only time you’ll use DC02’s console in this lesson.
On DC02, run this. It sets the address and DNS, then joins and renames in one go:
New-NetIPAddress -InterfaceAlias Ethernet -IPAddress 10.0.0.11 -PrefixLength 24 -DefaultGateway 10.0.0.1 | Out-Null
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.0.10
Add-Computer -DomainName saatlab.internal -NewName DC02 -Credential SAATLAB\Administrator -Restart-NewName renames and joins with a single restart. DC02 goes into the Computers container for now; promotion will move it to Domain Controllers.
✅ Checkpoint: DC02 restarts and its console shows the name DC02 and the domain SAATLAB.
7Promote DC02 remotely from DC01
Everything from here happens on DC01. PowerShell remoting (WinRM) is on by default on Windows Server, so you can run commands on DC02 over the network.
On DC01, run this. Enter the SAATLAB\Administrator password, then a DSRM password for DC02:
Install-WindowsFeature AD-Domain-Services -ComputerName DC02 -IncludeManagementTools
$cred = Get-Credential SAATLAB\Administrator
$dsrm = Read-Host -AsSecureString 'DSRM password for DC02'
Invoke-Command -ComputerName DC02 -ScriptBlock {
Install-ADDSDomainController -DomainName saatlab.internal -InstallDns -Credential $using:cred -SafeModeAdministratorPassword $using:dsrm -Force
}You should see something like this:
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No Success {Active Directory Domain Services, Group P...
WARNING: Windows Server 2025 domain controllers have a default for the security setting named "Allow cryptography
algorithms compatible with Windows NT 4.0" that prevents weaker cryptography algorithms when establishing security
channel sessions.
...
Processing data. This may take a few minutes...Warnings like these are normal; you saw similar ones in Lesson 11. DC02 copies the directory from DC01, then restarts by itself, so the remote session ends, sometimes with an error saying the connection was closed. Wait two or three minutes.
Then give DC02 its DNS settings (partner first, itself second) and add DC02 as DC01's second DNS server:
Invoke-Command -ComputerName DC02 -ScriptBlock { Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.0.10, 127.0.0.1 }
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.0.10, 10.0.0.11✅ Checkpoint: DC02 restarted after promotion and both DNS commands ran without errors.
8Prove the two DCs replicate
On DC01, list the domain controllers:
Get-ADDomainController -Filter * | Select-Object Name, IPv4Address, IsGlobalCatalog, OperatingSystemYou should see something like this:
Name IPv4Address IsGlobalCatalog OperatingSystem
---- ----------- --------------- ---------------
DC01 10.0.0.10 True Windows Server 2025 Datacenter Evaluation
DC02 10.0.0.11 True Windows Server 2025 Datacenter EvaluationNow write on DC02 and read on DC01:
New-ADUser -Name 'Repl Test' -SamAccountName repl.test -Path 'OU=Sales,OU=Staff,OU=SAATLAB,DC=saatlab,DC=internal' -Server DC02
Start-Sleep -Seconds 30
Get-ADUser repl.test -Server DC01 | Select-Object Name, DistinguishedName
repadmin /replsummaryThe user was created on DC02 and read from DC01 30 seconds later, so replication works in both directions you care about. repadmin /replsummary gives the overview admins check every day:
You should see something like this:
Name DistinguishedName
---- -----------------
Repl Test CN=Repl Test,OU=Sales,OU=Staff,OU=SAATLAB,DC=saatlab,DC=internal
Replication Summary Start Time: 2026-10-19 16:42:10
Beginning data collection for replication summary, this may take awhile:
.....
Source DSA largest delta fails/total %% error
DC01 04m:12s 0 / 5 0
DC02 03m:48s 0 / 5 0
Destination DSA largest delta fails/total %% error
DC01 03m:48s 0 / 5 0
DC02 04m:12s 0 / 5 0Read the fails/total column: 0 failures out of 5 partitions (schema, configuration, the domain, and the two DNS zones partitions). “Largest delta” is the time since the last successful replication. A few minutes is fine; hours or an error number is your cue for Lesson 45.

Clean up and take snapshots. Remove the test user, shut down every VM, then on your laptop:
Remove-ADUser repl.test -Confirm:$false # on DC01
'DC01','DC02','SRV01','CL01' | ForEach-Object { VBoxManage snapshot $_ take "Domain joined" } # on your laptop✅ Checkpoint: Both DCs show IsGlobalCatalog True, replsummary shows 0 failures, and all four VMs have a “Domain joined” snapshot.
Break It, Then Fix It
You’ll break CL01 twice and fix it twice. These two faults cover a big share of real “can’t join” and “can’t sign in” tickets. Start DC01 and CL01, and sign in to CL01 as labadmin, the local account.
1Break it: a client using public DNS
On CL01, in PowerShell as administrator:
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 1.1.1.1
Clear-DnsClientCache
nltest /dsgetdc:saatlab.internalYou’ll get an error like this:
Getting DC name failed: Status = 1355 0x54b ERROR_NO_SUCH_DOMAINnltest /dsgetdc runs the same DC locator a join uses. The public resolver has never heard of saatlab.internal, so no DC can be found. A join in this state fails with “The specified domain either does not exist or could not be contacted”, and people waste hours checking passwords that were never even sent.
Fix it: point back at your DCs and test again:
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.0.10, 10.0.0.11
nltest /dsgetdc:saatlab.internalYou should see something like this:
DC: \\DC01.saatlab.internal
Address: \\10.0.0.10
Dom Guid: 7c3f1a2e-5b8d-4e61-9a0f-2d4c6b8e1f37
Dom Name: saatlab.internal
Forest Name: saatlab.internal
Dc Site Name: Default-First-Site-Name
Our Site Name: Default-First-Site-Name
Flags: PDC GC DS LDAP KDC TIMESERV GTIMESERV WRITABLE DNS_DC DNS_DOMAIN DNS_FOREST CLOSE_SITE FULL_SECRET WS ...
The command completed successfully✅ Checkpoint: nltest fails with 1355 on 1.1.1.1 and finds a DC again on 10.0.0.10.
2Break it: the trust relationship
On DC01, reset CL01's computer account. This changes the password in AD only:
dsmod computer "CN=CL01,OU=Workstations,OU=SAATLAB,DC=saatlab,DC=internal" -resetYou should see this:
dsmod succeeded:CN=CL01,OU=Workstations,OU=SAATLAB,DC=saatlab,DC=internalRestart CL01 and try to sign in as SAATLAB\priya.sharma.
You’ll get an error like this:
The trust relationship between this workstation and the primary domain failed.AD now holds a password CL01 doesn’t know, so CL01 can’t build its secure channel and the DC won’t accept sign-ins through it. In real life this follows restoring an old VM snapshot or backup, or two machines sharing a name.
Fix it: sign in as labadmin, confirm, and repair:
Test-ComputerSecureChannel
Test-ComputerSecureChannel -Repair -Credential SAATLAB\AdministratorYou should see something like this:
False
True-Repair sets a new password on both sides, with no rejoin and no restart. Rejoining also works, but it creates a new SID for the computer account and loses its group memberships, so repair first.
✅ Checkpoint: After the repair, priya.sharma can sign in to CL01 again.

This happened at work
Forty clones and a September update
A team needed 40 test servers fast. They built one Windows Server 2025 VM, joined nothing, and copied its disk 40 times without running Sysprep.
Then they renamed the copies and joined them to the domain. Everything worked for months.
After the September 2025 cumulative update, users kept getting “your credentials didn’t work” when opening shares between those servers, and Remote Desktop between them failed. The System log showed LSA event 6167: “There is a partial mismatch in the machine ID.”
Microsoft had added checks that block authentication between machines with duplicate machine SIDs, which is exactly what un-sysprepped copies have. The only stopgap was a special policy from Microsoft Support. The servers had to be rebuilt from a template prepared with sysprep /generalize.
The lesson: never copy a Windows install without Sysprep, in VirtualBox or anywhere else. Install fresh, as you did in this course, or generalize the template first.
Common mistakes and troubleshooting
| Mistake or symptom | What happens | What to do instead |
|---|---|---|
| Member uses 1.1.1.1 or 8.8.8.8 for DNS | “The specified domain either does not exist or could not be contacted” | Members use only your DCs for DNS; test with nltest /dsgetdc |
| “The trust relationship between this workstation and the primary domain failed” | The computer and AD disagree on the computer password | Test-ComputerSecureChannel -Repair, signed in with a local admin |
| Rejoining a machine as the first fix | New SID, lost group memberships, and the same cause still there | Repair first; find out why it broke (old snapshot, duplicate name) |
| New computers all end up in CN=Computers | No Group Policy applies to them | Use -OUPath, pre-stage accounts or redirect with redircmp |
| Cloning VMs without Sysprep | Duplicate SIDs; sign-in failures since the 2025 updates | Sysprep /generalize the template, or install fresh |
| Only one DC | One failed disk takes down sign-ins for everyone | At least two DCs per domain, both DNS servers and global catalogs |
| A DC pointing only at itself for DNS | Slow or failed start-up after restarts; replication issues | Partner DC first, itself (127.0.0.1) second |
| Leaving MachineAccountQuota at 10 | Any user can join up to 10 machines | Set it to 0 and delegate the join right on an OU |
| Remote promotion seems to “fail” with a closed connection | The DC restarted, as it should | Wait, then check with Get-ADDomainController and repadmin |
Interview questions
Click a question to open it. Under each one you’ll find what the interviewer is really looking for, and one good way to answer.
Fresher level
1. What do you need before joining a computer to a domain?
What they’re really checking: Do you know the basics?
How you could answer: Network reach to a DC, DNS pointing at the domain’s DNS servers, the domain name, and an account allowed to join computers. Then Add-Computer or System Properties, and a restart.
2. What does “The trust relationship between this workstation and the primary domain failed” mean?
What they’re really checking: Have you met it?
How you could answer: The computer’s password in AD doesn’t match the one on the computer, so its secure channel fails. Sign in locally and run Test-ComputerSecureChannel -Repair, or reset and rejoin.
3. Why have two domain controllers?
What they’re really checking: Do you understand availability?
How you could answer: If one fails or is down for updates, people can still sign in and DNS still answers. Both hold a full writable copy of the domain and replicate changes to each other.
2–5 years experience
4. A new laptop can’t join: “domain does not exist or could not be contacted”. How do you troubleshoot?
What they’re really checking: Do you start with DNS?
How you could answer: Check the laptop’s DNS servers, then Resolve-DnsName -Type SRV _ldap._tcp.dc._msdcs.domain and nltest /dsgetdc:domain. Then check the network path and firewall to the DC on ports 53, 88, 389 and 445.
5. How do you control where new computers appear in AD and who can join them?
What they’re really checking: Do you think about policy?
How you could answer: Use -OUPath or pre-stage accounts, redirect the default with redircmp, set ms-DS-MachineAccountQuota to 0 and delegate “create computer objects” to a joining group on the target OU.
6. How do you check AD replication health?
What they’re really checking: Do you know the tools?
How you could answer: repadmin /replsummary for the overview, repadmin /showrepl for details per partition, Get-ADReplicationPartnerMetadata in PowerShell, and dcdiag. Look at failures and the largest delta.
Senior level
7. You must build 200 servers from a VM template. What do you watch for?
What they’re really checking: Do you know imaging pitfalls?
How you could answer: Generalize the template with Sysprep so each clone gets a unique SID, join during deployment with an OU path and a delegated account, and never clone a domain-joined machine or a DC.
8. Why might you choose Server Core for domain controllers?
What they’re really checking: Do you think about security and maintenance?
How you could answer: A smaller attack surface, fewer updates and restarts, and less temptation to use the DC as a workstation. It’s managed remotely with PowerShell, RSAT or Windows Admin Center.
9. How would you join machines with no line of sight to a DC, like a branch build?
What they’re really checking: Do you know offline domain join?
How you could answer: djoin /provision on a machine that can reach a DC creates the account and a blob file. djoin /requestODJ applies it on the new machine, which joins at its next start with no DC contact needed then.
Quick quiz
Q1. What does a computer look up first when it joins a domain?
- The DC’s MAC address
- DNS SRV records for a DC
- The domain admin’s email
Show answer
B — The DC locator uses DNS SRV records like _ldap._tcp.dc._msdcs.
Q2. What did nltest /dsgetdc return while CL01 used 1.1.1.1?
- ERROR_NO_SUCH_DOMAIN
- Access is denied
- Success
Show answer
A — Public DNS knows nothing about your internal domain.
Q3. What is the best first fix for a broken trust relationship?
- Reinstall Windows
- Test-ComputerSecureChannel -Repair
- Delete the user account
Show answer
B — It resets the computer password on both sides with no rejoin.
Q4. Why did DC02’s remote session end with a closed connection?
- Promotion failed
- DC02 restarted after promotion
- WinRM is off on Server Core
Show answer
B — A new DC restarts itself; check it afterwards.
Q5. In the work story, what caused the sign-in failures?
- Expired passwords
- Clones with duplicate SIDs made without Sysprep
- A broken DNS forwarder
Show answer
B — Updates from late 2025 block authentication between duplicate-SID machines.
Quick recap
- To join computer to domain, point DNS at your DCs, test with
nltest /dsgetdc, then useAdd-Computer(with-OUPath) or System Properties. - Each member has a computer account and a password;
Test-ComputerSecureChannel -Repairfixes a broken trust. - New computers go to CN=Computers unless you choose the OU; move them with
Move-ADObject. - DC02 on Server Core was joined, then promoted remotely with
Invoke-CommandandInstall-ADDSDomainController. - Check replication with
Get-ADDomainController, a test object andrepadmin /replsummary. - Never clone Windows without Sysprep.
Next lesson
Lesson 14: DNS in depth → You’ll look inside the saatlab.internal zones, create A, CNAME and PTR records, add a reverse zone, compare forwarders and conditional forwarders, and troubleshoot name resolution step by step.
Further reading: join computer to domain
Want to go deeper into join computer to domain? Microsoft’s Add-Computer reference lists every join option, and the Install-ADDSDomainController reference covers adding DCs. You can also see the full plan for this course on the Windows Server Administration course page.
