Windows Servers
How to Install Active Directory Domain Services (AD DS)
By NileVPS Team · Published · 4 min read
اقرأ المقال بالعربيActive Directory Domain Services (AD DS) is the directory behind most Windows networks. It stores users, groups and computers, handles authentication with Kerberos, and lets you push settings through Group Policy. Installing it is quick, but the decisions you make beforehand, especially the domain name and DNS layout, are hard to change later. This guide covers the planning, the installation itself with both the GUI and PowerShell, and the checks to run afterwards.
Plan before you click Install
Choose the domain name carefully
The best practice is to use a subdomain of a public domain you own, for example ad.example.com or corp.example.com. Avoid single-label names such as corp, and avoid .local, which conflicts with multicast DNS on many devices. Renaming a domain later is possible but disruptive, so treat this as permanent.
You also choose a NetBIOS name (for example CORP), up to 15 characters, which users see in the CORP\username login format.
Prepare the server
- Static IP address. A domain controller must not change its address. On a VPS, keep the address assigned by the provider and configure it statically if the network adapter uses DHCP inside Windows.
- Final hostname. Rename the server before promotion, for example
DC01. Renaming a domain controller afterwards takes extra steps. - Updates. Install all pending Windows updates and reboot.
- Time. Kerberos is sensitive to clock differences, so make sure the server time is correct.
Rename-Computer -NewName DC01 -RestartThink about network exposure
Domain controllers should never be reachable from the public internet on ports such as 88 (Kerberos), 389 (LDAP), 445 (SMB) or 3268 (Global Catalog). If you host a DC on a VPS, connect offices and other servers through a VPN or a private network, and use the cloud firewall to block everything except what you explicitly need.
Installing the AD DS role
With Server Manager
- Open Server Manager > Manage > Add Roles and Features.
- Select Active Directory Domain Services and accept the required features.
- Finish the wizard. When installation completes, click the notification flag and choose Promote this server to a domain controller.
- Select Add a new forest, enter the root domain name, and continue.
- Leave DNS server and Global Catalog checked, set the Directory Services Restore Mode (DSRM) password, and accept the default paths unless you have a reason to change them.
- Review the prerequisites check and click Install. The server reboots automatically.
With PowerShell
Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
Install-ADDSForest `
-DomainName "ad.example.com" `
-DomainNetbiosName "CORP" `
-InstallDns `
-ForestMode "WinThreshold" `
-DomainMode "WinThreshold" `
-SafeModeAdministratorPassword (Read-Host -AsSecureString "DSRM password")WinThreshold corresponds to the Windows Server 2016 functional level, which is the highest available on Windows Server 2019 and 2022. Store the DSRM password in a safe place: you need it to boot into recovery mode.
Default locations, which you can keep for most deployments:
| Item | Default path |
|---|---|
| Database (NTDS.dit) | C:\Windows\NTDS |
| Log files | C:\Windows\NTDS |
| SYSVOL | C:\Windows\SYSVOL |
After the reboot: verify the domain
Log in as CORP\Administrator and run:
Get-ADDomain | Select-Object DNSRoot, NetBIOSName, DomainMode
Get-ADDomainController | Select-Object HostName, IPv4Address, IsGlobalCatalog
dcdiag /v
Resolve-DnsName -Name _ldap._tcp.dc._msdcs.ad.example.com -Type SRVdcdiag should pass all major tests. The SRV lookup proves clients can find the domain controller through DNS, which is how domain join actually works.
Fix DNS settings
The domain controller's network adapter should use its own IP address (or 127.0.0.1 as a secondary entry) as its DNS server. Public resolvers belong in the DNS server's forwarders, not on the adapter:
Add-DnsServerForwarder -IPAddress 1.1.1.1, 9.9.9.9Every machine that joins the domain must use the domain controller as its DNS server, otherwise it will not find the domain.
First tasks in the new domain
- Create organizational units (OUs) for users, computers and servers instead of leaving everything in the default containers.
- Create a named admin account for yourself and stop using the built-in Administrator for daily work.
- Set a password and lockout policy in the Default Domain Policy or with fine-grained password policies.
- Plan a second domain controller. A single DC is a single point of failure for every login. Our guide on promoting a domain controller covers adding one.
Backups and snapshots
Back up the system state of each domain controller regularly with Windows Server Backup or your backup tool. Be careful with VM snapshots: restoring an old snapshot of a domain controller in an environment with more than one DC can cause replication problems such as USN rollback. Whether the hypervisor exposes VM-Generation ID protection varies, so prefer proper system state backups for recovery and use snapshots mainly before planned changes on a single-DC lab.
FAQ
Can I install Active Directory on a VPS?
Yes, as long as the VPS runs Windows Server and you control its networking. Keep the domain controller off the public internet, connect clients through a VPN or private network, and size it with at least 2 GB of RAM for small directories.
Should the domain controller also run other roles?
Keep it as clean as possible. DNS is expected on a DC, but web servers, databases or Remote Desktop Session Hosts should run on separate member servers to reduce risk and simplify maintenance.
Can Linux servers join the domain?
Yes. Tools such as realmd and SSSD let Linux machines authenticate against Active Directory. See our guide on joining Linux to Active Directory for the details.