Before you start
- One or two Windows Server 2025 servers installed and up to date, with a licensed edition (see installing Windows Server 2025)
- A static IP address per server and an addressing plan (see IP address, subnet mask and gateway)
- Some knowledge of PowerShell
In plain words
Active Directory is the company's central directory: the list of people, computers and groups, with their passwords and their rights. An employee signs in once with their account, and every computer, printer or shared folder knows who they are and what they can do. The domain controller is the server that holds this directory, a bit like a building's reception desk that checks badges and knows who has access to which floor. Like a reception desk, it must never be alone: you always plan two.
1. The vocabulary in one table
| Term | What it is |
|---|---|
| Domain | The set of accounts and computers managed together, for example ad.example.com |
| Forest | The top-level container, grouping one or more domains. For a small business: one forest, one domain. |
| Domain controller (DC) | Server that hosts the directory, authenticates sign-ins (Kerberos) and replicates changes to the other DCs |
| DNS | Essential: computers find the domain controllers through special DNS records. Without correct DNS, nothing works. |
| Organisational unit (OU) | A folder in the directory to store accounts and computers, delegate rights and apply policies |
| Group Policy Object (GPO) | A set of settings applied automatically to the computers and users of an OU |
| FSMO roles | Five special roles held by only one DC at a time, including the PDC emulator, the domain's time reference |
| Functional level | The minimum DC version allowed, which unlocks features. Windows Server 2025 brings a new level. |
2. Choosing the domain name carefully
The name is chosen once and for all: renaming it later is long and risky.
| Choice | Verdict | Why |
|---|---|---|
ad.example.com (subdomain of a domain you own) |
Recommended | Unique worldwide, no conflict with the website, compatible with Microsoft 365 and certificates |
example.com (the same as the public website) |
Not recommended | Internal and public DNS step on each other: the website becomes hard to reach from inside |
example.local |
Avoid | Not routable, conflicts with mDNS (Bonjour, Avahi), and requires adjustments for Microsoft 365 |
example (a single word) |
Forbidden | Single-label name, a source of many problems, rejected by the wizard |
The NetBIOS name (old short name, 15 characters maximum) is suggested automatically from the first word. For ad.example.com, choose EXAMPLE instead: it's the one that appears in EXAMPLE\spo.
If a .local domain already exists
No need to rebuild everything: to synchronise with Microsoft 365, just add a routable UPN suffix (example.com) and assign it to the accounts. See hybrid identity with AD, Entra and Microsoft 365.
3. Prepare the server
In this example, we build two domain controllers:
| Server | IP address | Preferred DNS | Alternate DNS |
|---|---|---|---|
DC01 |
192.168.10.11 | 192.168.10.12 (DC02) | 127.0.0.1 |
DC02 |
192.168.10.12 | 192.168.10.11 (DC01) | 127.0.0.1 |
While creating the forest, DC01 will point to itself: we'll correct this when DC02 arrives.
Before starting, on DC01:
- Licensed edition: a domain controller installed as an evaluation version can't be converted.
- Final name: rename the server before promotion; renaming it afterwards is tricky.
- Static IP address and correct mask, gateway filled in.
- Updates all installed.
- Virtual machine: turn off time synchronisation by the hypervisor (the domain will have its own time source) and never plan to restore a DC from a snapshot.
Rename the server and set the address in PowerShell (as administrator). Adapt the network adapter's name, shown by Get-NetAdapter:
Rename-Computer -NewName "DC01" -Restart
New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 192.168.10.11 `
-PrefixLength 24 -DefaultGateway 192.168.10.1
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" `
-ServerAddresses 127.0.0.1
A domain controller has one job
No file or printer sharing, no line-of-business application, no internet browsing. A compromised DC means the whole domain is compromised. It does directory and DNS, and nothing else.
4. Install the role and create the forest
Install the role with its administration tools:
Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
First check that everything is ready, without changing anything. The password asked for is the Directory Services Restore Mode (DSRM) password, an emergency account specific to each DC: keep it in the team's password manager.
Test-ADDSForestInstallation -DomainName "ad.example.com" `
-DomainNetbiosName "EXAMPLE" -InstallDns `
-SafeModeAdministratorPassword (Read-Host -AsSecureString "DSRM password")
If the test only reports known warnings (DNS delegation impossible, for example), create the forest. The server restarts by itself at the end:
Install-ADDSForest -DomainName "ad.example.com" -DomainNetbiosName "EXAMPLE" `
-ForestMode Win2025 -DomainMode Win2025 -InstallDns `
-SafeModeAdministratorPassword (Read-Host -AsSecureString "DSRM password")
-ForestMode Win2025 -DomainMode Win2025sets the Windows Server 2025 functional level: only Windows Server 2025 DCs will be able to join the domain. If you need to accept older DCs, useWinThreshold(Windows Server 2016 level, the minimum for a new forest).- The warning "A delegation for this DNS server cannot be created" is normal for an internal domain: ignore it.
With the graphical interface
You get the same result through Server Manager: notification flag > Promote this server to a domain controller > Add a new forest. The last screen offers View script: it generates exactly the matching PowerShell command, handy for documentation.
5. Check that the domain works
Sign back in with EXAMPLE\Administrator, then check the domain, the forest and the functional level:
Get-ADDomain | Select-Object DNSRoot, NetBIOSName, DomainMode, PDCEmulator
Get-ADForest | Select-Object Name, ForestMode, SchemaMaster
Check the essential services and the DNS records that let computers find the DC:
Get-Service adws, kdc, netlogon, dns | Select-Object Name, Status
Resolve-DnsName -Type SRV _ldap._tcp.dc._msdcs.ad.example.com
Finally, run the full diagnostic. /q only shows errors: empty output is a good sign.
dcdiag /q
6. Set up DNS
Forwarders: the domain's DNS answers for ad.example.com and passes on the rest. Enter the resolvers of your choice (your firewall, your internet provider, or a public resolver):
Set-DnsServerForwarder -IPAddress 192.168.10.1, 9.9.9.9
Reverse lookup zone, useful for diagnostics and some software:
Add-DnsServerPrimaryZone -NetworkId "192.168.10.0/24" -ReplicationScope Forest
Scavenging of stale records, so that computers that have gone don't stay in DNS forever:
Set-DnsServerScavenging -ScavengingState $true `
-ScavengingInterval 7.00:00:00 -ApplyOnAllZones
The golden rule of DNS
Every computer in the domain, controllers included, uses only the DCs as DNS servers. Never the internet router's address or a public DNS as a secondary server: a computer that queries the wrong server can no longer find the domain, at random. External resolvers are set in the forwarders, not on the computers. Hand out the DCs' addresses through DHCP (option 006).
7. Set up time
Kerberos refuses any sign-in if a computer's clock is more than 5 minutes off the DC's. Computers sync with the DCs, the DCs with the PDC emulator, and only it must query an external source. On DC01 (which holds the PDC role):
w32tm /config /manualpeerlist:"0.pool.ntp.org,0x8 1.pool.ntp.org,0x8" `
/syncfromflags:manual /reliable:yes /update
Restart-Service w32time
w32tm /resync
w32tm /query /status
The output must show a Source matching one of the NTP servers. You can use your country's pool zone (for example 0.uk.pool.ntp.org). If outbound NTP (UDP 123) is filtered, use your firewall's NTP server.
8. Organise the directory
Don't leave everything in the default Users and Computers containers: group policies can't be applied finely to them. A simple tree is enough:
ad.example.com
└── EXAMPLE
├── Users
│ ├── Management
│ ├── Accounting
│ └── Production
├── Computers
│ ├── Desktops
│ ├── Laptops
│ └── Servers
├── Groups
├── Service-accounts
└── Administration
├── Admin-accounts
└── Admin-groups
Create it in PowerShell:
$root = "DC=ad,DC=example,DC=com"
New-ADOrganizationalUnit -Name "EXAMPLE" -Path $root
$base = "OU=EXAMPLE,$root"
$tree = [ordered]@{
"" = "Users","Computers","Groups",
"Service-accounts","Administration"
"Users" = "Management","Accounting","Production"
"Computers" = "Desktops","Laptops","Servers"
"Administration" = "Admin-accounts","Admin-groups"
}
foreach ($parent in $tree.Keys) {
$path = if ($parent) { "OU=$parent,$base" } else { $base }
foreach ($ou in $tree[$parent]) {
New-ADOrganizationalUnit -Name $ou -Path $path
}
}
The OUs are created protected from accidental deletion. Then make new computers and users land directly in the right OUs:
redircmp "OU=Desktops,OU=Computers,OU=EXAMPLE,DC=ad,DC=example,DC=com"
redirusr "OU=Users,OU=EXAMPLE,DC=ad,DC=example,DC=com"
9. Administration accounts
The principle: one account to work, another to administer. The spo account reads email and browses; the adm-spo account administers the domain, and is used for nothing else.
$ou = "OU=Admin-accounts,OU=Administration,OU=EXAMPLE,DC=ad,DC=example,DC=com"
New-ADUser -Name "adm-spo" -SamAccountName "adm-spo" `
-UserPrincipalName "adm-spo@ad.example.com" -Path $ou `
-AccountPassword (Read-Host -AsSecureString "Password") -Enabled $true
Add-ADGroupMember -Identity "Domain Admins" -Members "adm-spo"
Add-ADGroupMember -Identity "Protected Users" -Members "adm-spo"
On a Windows Server installed in another language, built-in group names are translated (for example Admins du domaine in French). The Protected Users group hardens the account: no credential caching, no delegation, Kerberos with AES encryption only.
Then:
- Give the built-in
Administratoraccount a long, unique password, kept in the team's vault, and stop using it day to day. - Sign in with domain administration accounts only on the DCs and a dedicated administration workstation, never on a user's computer.
-
Keep the Domain Admins group as small as possible, and check its membership regularly:
Get-ADGroupMember "Domain Admins" -Recursive | Select-Object Name
To go further on identities and passwords, see identity management.
10. Security features to turn on from the start
Active Directory Recycle Bin: lets you restore a deleted object (account, group, OU) with all its attributes. Irreversible once enabled, and with no drawback:
Enable-ADOptionalFeature "Recycle Bin Feature" -Scope ForestOrConfigurationSet `
-Target "ad.example.com" -Confirm:$false
Windows LAPS: a local administrator password different on every computer, changed automatically and stored in the directory. Prepare the schema and give computers the right to write their own password:
Update-LapsADSchema
Set-LapsADComputerSelfPermission `
-Identity "OU=Computers,OU=EXAMPLE,DC=ad,DC=example,DC=com"
Then enable the LAPS policy through a GPO on the Computers OU (Computer Configuration > Administrative Templates > System > LAPS), with the password backed up to Active Directory. A computer's password is read with Get-LapsADPassword -Identity PC042 -AsPlainText.
Stop users from joining computers to the domain: by default, any account can add ten. Keep this right for the IT department:
Set-ADDomain -Identity "ad.example.com" `
-Replace @{"ms-DS-MachineAccountQuota"="0"}
KDS root key, needed for managed service accounts (gMSA, and dMSA, new in Windows Server 2025), which replace service accounts with fixed passwords:
Add-KdsRootKey -EffectiveImmediately
The key is only really usable after replication to all the DCs (up to 10 hours).
What's already hardened in Windows Server 2025: for a new forest, LDAP signing is required by default, LDAP over TLS accepts TLS 1.3, and old remote password-change methods are blocked. Old devices (copiers that scan to a folder, old applications) that connect with unsigned LDAP will be refused: find them through events 2887 and 2889 in the Directory Service log, and configure them for LDAPS.
Password policy: edit the Default Domain Policy or create a fine-grained password policy. Current recommendations favour length (15 characters or more) over complexity and forced changes, with lockout after several failures.
11. Add a second domain controller
A single DC is a domain that stops at the first failure. On DC02, prepared like DC01 (name, static IP), point DNS to DC01, then:
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" `
-ServerAddresses 192.168.10.11
Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
Install-ADDSDomainController -DomainName "ad.example.com" -InstallDns `
-Credential (Get-Credential "EXAMPLE\adm-spo") `
-SafeModeAdministratorPassword (Read-Host -AsSecureString "DC02 DSRM password")
After the restart, check replication. No error should appear:
repadmin /replsummary
repadmin /showrepl
Finally, set each DC's DNS as in the table in section 3: the other DC first, itself (127.0.0.1) second.
12. Join a computer to the domain
The computer must use the DCs as DNS servers (through DHCP, or by hand for a test). On the computer, as administrator, with an account allowed to join machines:
Add-Computer -DomainName "ad.example.com" `
-OUPath "OU=Desktops,OU=Computers,OU=EXAMPLE,DC=ad,DC=example,DC=com" `
-Credential (Get-Credential "EXAMPLE\adm-spo") -Restart
After the restart, sign in with a domain account, then check the trust relationship and the DC in use:
Test-ComputerSecureChannel
nltest /dsgetdc:ad.example.com
13. Back up
Back up the system state of at least two DCs every day, with a tool compatible with Active Directory. With the built-in tool (the Windows Server Backup feature), to a dedicated disk or share:
Install-WindowsFeature Windows-Server-Backup
wbadmin start systemstatebackup -backupTarget:E: -quiet
- An AD backup older than 180 days (the tombstone lifetime of deleted objects) can no longer be restored: keep recent backups.
- Keep each DC's DSRM password outside the domain: it's essential for a restore.
- Write the restore procedure in your knowledge base, with an offline copy, and apply the 3-2-1 rule.
14. Troubleshooting
| Symptom | Likely cause | Check or solution |
|---|---|---|
| "An Active Directory Domain Controller for the domain could not be contacted" when joining a computer | The computer doesn't use the DCs as DNS | ipconfig /all, then Resolve-DnsName -Type SRV _ldap._tcp.dc._msdcs.ad.example.com |
| Sign-ins refused, Kerberos errors | Clock skew | w32tm /query /status on the computer and the DC |
| Very slow sign-in | External DNS server as secondary on the computer | Remove any DNS server that isn't a DC |
| Replication errors between DCs | DNS, firewall or time | repadmin /replsummary, dcdiag /test:replications, dcdiag /test:dns |
| "The trust relationship between this workstation and the primary domain failed" | Computer account password out of sync (often after restoring a snapshot) | Test-ComputerSecureChannel -Repair -Credential (Get-Credential) |
| A copier can no longer read the directory | LDAP signing required | Switch the copier to LDAPS (port 636); events 2887 and 2889 |
15. Checklist
| Item | Done? |
|---|---|
Domain name as a subdomain of a domain you own (ad.example.com), NetBIOS name chosen |
☐ |
| Servers licensed, named and on a static IP before promotion | ☐ |
| At least two domain controllers, replication with no errors | ☐ |
| DSRM passwords kept in the team's vault | ☐ |
| DNS: forwarders, reverse zone, scavenging; computers pointing only to the DCs | ☐ |
| PDC emulator synced to an external NTP source | ☐ |
OU tree created, redircmp and redirusr applied |
☐ |
| Separate administration accounts, in Protected Users; Domain Admins reduced to the minimum | ☐ |
| AD Recycle Bin enabled | ☐ |
| Windows LAPS deployed on member computers and servers | ☐ |
ms-DS-MachineAccountQuota set to 0 |
☐ |
| Daily system state backup of at least two DCs, restore documented | ☐ |
dcdiag /q with no errors |
☐ |
Sources
- Microsoft: install Active Directory Domain Services
- Microsoft: Install-ADDSForest
- Microsoft: naming conventions in Active Directory
- Microsoft: selecting the forest root domain
- Microsoft: AD DS functional levels
- Microsoft: what's new in Windows Server 2025
- Microsoft: LDAP signing in AD DS
- Microsoft: delegated managed service accounts (dMSA)
- Microsoft: prepare a non-routable domain for directory synchronization