🏠 Home / Hub

Lesson 2 — Active Directory Domain Services (AD DS)

Active Directory is the cornerstone of Windows enterprise environments. It provides centralized authentication, authorization, policy management, and a directory of all network objects. This lesson covers the core concepts, installation, and daily administration tasks.

1. Core AD DS Concepts

ConceptDefinitionExample
DomainA logical grouping of network objects (users, computers, groups) that share the same AD database, security policies, and trust relationshipscompany.com, lab.local
ForestOne or more domain trees that share a common schema and Global Catalog. The forest is the security boundary in AD.company.com (root) + subsidiary.com
TreeOne or more domains with a contiguous namespace that share a two-way transitive trustcompany.com → sales.company.com → us.sales.company.com
Domain Controller (DC)A server that hosts the AD DS database (NTDS.DIT), authenticates users, and enforces domain policiesSRV-DC01, SRV-DC02 (for redundancy)
Organizational Unit (OU)A container within a domain used to organize objects and apply Group Policy. OUs can be nested.OU=IT, OU=HR, OU=Servers
SchemaDefines all object types and their attributes in the directory. One schema per forest.User object has attributes: givenName, sAMAccountName, mail…
Global Catalog (GC)A partial replica of all objects in the forest. Enables cross-domain searches and UPN logon.First DC in forest is always a GC server
TrustA relationship allowing users in one domain to access resources in another domainTransitive trust (automatic within forest), external trust (manual)

2. LDAP Distinguished Names (DN) Structure

Every object in Active Directory has a unique Distinguished Name that describes its location in the directory hierarchy. LDAP tools and PowerShell use these names.

# LDAP DN components:
# DC  = Domain Component  (parts of the domain name)
# OU  = Organizational Unit container
# CN  = Common Name (users, groups, computers, containers)

# Examples:
DC=company,DC=com                              # The root of the domain
OU=IT,DC=company,DC=com                        # The IT OU at root level
OU=Admins,OU=IT,DC=company,DC=com              # Admins OU nested inside IT OU
CN=John Smith,OU=IT,DC=company,DC=com          # User John Smith in IT OU
CN=Domain Admins,CN=Users,DC=company,DC=com    # Domain Admins group (built-in)
CN=SRV-WEB01,OU=Servers,DC=company,DC=com      # Computer object in Servers OU

# The sAMAccountName (pre-Windows 2000) is the logon name used for domain logon:
# Domain\jsmith  (NETBIOS format)
# jsmith@company.com (UPN format — preferred)

3. Install AD DS and Promote to Domain Controller

Prerequisites

Step 1: Install the AD DS Role

# Via PowerShell (fastest method):
Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools

# Verify installation
Get-WindowsFeature -Name AD-Domain-Services

Step 2: Promote Server to Domain Controller (New Forest)

After installing the role, a notification appears in Server Manager. Click it and select "Promote this server to a domain controller" — or use PowerShell:

# Create a NEW forest (first DC in the environment)
Install-ADDSForest `
  -DomainName "lab.local" `
  -DomainNetbiosName "LAB" `
  -DomainMode "WinThreshold" `
  -ForestMode "WinThreshold" `
  -DatabasePath "C:\Windows\NTDS" `
  -LogPath "C:\Windows\NTDS" `
  -SysvolPath "C:\Windows\SYSVOL" `
  -InstallDns:$true `
  -SafeModeAdministratorPassword (ConvertTo-SecureString "P@ssw0rd123!" -AsPlainText -Force) `
  -Force

# The server will restart automatically after promotion

# Add a SECOND DC to an existing domain
Install-ADDSDomainController `
  -DomainName "lab.local" `
  -InstallDns:$true `
  -Credential (Get-Credential) `
  -SafeModeAdministratorPassword (ConvertTo-SecureString "P@ssw0rd123!" -AsPlainText -Force) `
  -Force
The Safe Mode Administrator Password (DSRM password) is used to boot the DC into Directory Services Restore Mode for offline maintenance. Store it securely — it is separate from the regular Administrator password.

What Gets Created After Promotion

4. Active Directory Users and Computers (ADUC)

ADUC (dsa.msc) is the primary GUI tool for managing users, groups, computers, and OUs. It is available on any machine with RSAT (Remote Server Administration Tools) installed.

# Install RSAT on Windows 10/11 (to manage AD remotely)
# Via Settings → Apps → Optional Features → RSAT: Active Directory...
# Or via PowerShell:
Add-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0

# Open ADUC
dsa.msc

# Enable "Advanced Features" to see all attributes and system containers:
# View menu → Advanced Features

5. Creating User Accounts

GUI Method

  1. Open ADUC (dsa.msc)
  2. Navigate to the target OU (e.g., OU=IT)
  3. Right-click → New → User
  4. Enter: First name, Last name, Full name (auto-populated), User logon name (UPN prefix)
  5. Click Next → Set password → configure password options
  6. Click Finish

Important Password Options

OptionWhen to Use
User must change password at next logonDefault for new accounts — forces user to set their own password
User cannot change passwordService accounts, shared accounts
Password never expiresService accounts only — use with strong passwords and monitor carefully
Account is disabledTemplate accounts, accounts created in advance

User Account Properties Tabs

TabKey Settings
GeneralDisplay name, description, office, phone, email, web page
AccountLogon name (UPN), logon hours (restrict to business hours), account expiry, logon workstations, account options
ProfileProfile path (roaming profile), logon script, home folder (drive letter + UNC path)
Member OfView and modify group memberships — this is where you add users to groups
Dial-inRemote Access (VPN) permissions — usually set to "Control access through NPS Network Policy"
Environment / Sessions / Remote controlTerminal Services / RDS specific settings

6. Security Groups

Group Scope

ScopeMembers Can Be FromUsed For Resources InBest Practice Use
Domain LocalAny domain in forest + trusted domainsSame domain onlyResource access groups (e.g., "DL-FileShare-ReadWrite")
GlobalSame domain onlyAny domain in forestUser account groups (e.g., "GG-IT-Department")
UniversalAny domain in forestAny domain in forestMulti-domain role groups; avoid unless needed (GC replication impact)

AGDLP Strategy (Microsoft Recommended)

Accounts (users) placed into Global groups, Global groups placed into Domain Local groups, Domain Local groups assigned Permissions to resources.

Example: User "jsmith" → GG-IT-Staff → DL-FileServer01-ReadWrite → Share permissions on \\FileServer01\Data

Group Types

# Create a Global Security Group
New-ADGroup -Name "GG-IT-Staff" -GroupScope Global -GroupCategory Security `
  -Path "OU=Groups,DC=lab,DC=local" -Description "IT Department staff"

# Add members to group
Add-ADGroupMember -Identity "GG-IT-Staff" -Members "jsmith","bjones","akim"

# View group members
Get-ADGroupMember -Identity "GG-IT-Staff" | Select-Object Name, SamAccountName, objectClass

# Add a group to another group (nesting)
Add-ADGroupMember -Identity "DL-FileServer-IT" -Members "GG-IT-Staff"

7. Organizational Units (OUs)

OUs are containers that organize objects within a domain. They serve two purposes: logical organization of objects, and the application of Group Policy Objects (GPOs).

Example OU Structure

DC=lab,DC=local ├── OU=_Lab (top-level container for all custom objects) │ ├── OU=Users │ │ ├── OU=IT │ │ ├── OU=HR │ │ ├── OU=Sales │ │ └── OU=Service Accounts │ ├── OU=Groups │ │ ├── OU=Security Groups │ │ └── OU=Distribution Groups │ ├── OU=Computers │ │ ├── OU=Workstations │ │ └── OU=Laptops │ └── OU=Servers │ ├── OU=Domain Controllers (linked to DC-specific GPOs) │ ├── OU=Member Servers │ └── OU=DMZ
# Create OU structure via PowerShell
New-ADOrganizationalUnit -Name "_Lab" -Path "DC=lab,DC=local"
New-ADOrganizationalUnit -Name "Users" -Path "OU=_Lab,DC=lab,DC=local"
New-ADOrganizationalUnit -Name "IT" -Path "OU=Users,OU=_Lab,DC=lab,DC=local"
New-ADOrganizationalUnit -Name "HR" -Path "OU=Users,OU=_Lab,DC=lab,DC=local"
New-ADOrganizationalUnit -Name "Groups" -Path "OU=_Lab,DC=lab,DC=local"
New-ADOrganizationalUnit -Name "Computers" -Path "OU=_Lab,DC=lab,DC=local"
New-ADOrganizationalUnit -Name "Servers" -Path "OU=_Lab,DC=lab,DC=local"

# List all OUs in the domain
Get-ADOrganizationalUnit -Filter * | Select-Object Name, DistinguishedName | Sort-Object DistinguishedName
By default, the built-in "Computers" container is not an OU — it's a CN (container). It cannot have GPOs linked directly to it. Move computers to proper OUs using PowerShell or redirect the default computer container.
# Redirect default computer container to a custom OU
redircmp "OU=Workstations,OU=Computers,OU=_Lab,DC=lab,DC=local"

# Now new domain-joined computers land in that OU automatically

8. Delegation of Control

Delegation lets you grant specific administrative permissions over an OU without giving full Domain Admin rights. This follows the principle of least privilege.

Common Delegation Scenarios

# GUI: Right-click OU in ADUC → Delegate Control → Delegation of Control Wizard
# Select users/groups → select tasks (e.g., "Reset user passwords and force password change")

# PowerShell: Grant permission to reset passwords in an OU
$ou = "OU=IT,OU=_Lab,DC=lab,DC=local"
$helpdesk = [System.Security.Principal.SecurityIdentifier](Get-ADGroup "GG-HelpDesk").SID

# Use dsacls command for fine-grained delegation:
# Reset Password permission on user objects
dsacls $ou /G "$($helpdesk):CA;Reset Password;user" /I:S

# Unlock Account permission
dsacls $ou /G "$($helpdesk):CA;Change Password;user" /I:S

9. Joining a Computer to the Domain

# GUI Method:
# 1. Right-click This PC → Properties → Change settings
# 2. Computer Name tab → Change
# 3. Select "Domain" → type domain name (lab.local)
# 4. Enter domain admin credentials
# 5. Restart

# PowerShell Method (faster, scriptable):
Add-Computer -DomainName "lab.local" -Credential (Get-Credential) -Restart -Force

# Join to domain AND move to specific OU in one step:
Add-Computer -DomainName "lab.local" `
  -OUPath "OU=Workstations,OU=Computers,OU=_Lab,DC=lab,DC=local" `
  -Credential (Get-Credential) `
  -Restart -Force

# Verify domain membership
(Get-WmiObject Win32_ComputerSystem).Domain
The computer performing the domain join must be able to reach a domain controller. DNS must be configured to point to the DC's IP address — this is critical. If DNS cannot resolve the domain name, the join will fail.

10. Active Directory Sites and Services

AD Sites and Services (dssite.msc) manages replication between DCs across physical locations (WAN links).

# Force immediate replication between DCs
repadmin /syncall /AdeP

# Check replication status across all DCs
repadmin /replsummary

# Show replication partners for this DC
repadmin /showrepl

# View replication queue (pending items)
repadmin /showreps

11. FSMO Roles (Flexible Single Master Operations)

Certain AD operations must happen on exactly one DC at a time. These are called FSMO (flexible single master operations) roles.

FSMO RoleScopeFunction
Schema MasterForest-wide (1 per forest)Controls all schema modifications (adding new attributes or object classes)
Domain Naming MasterForest-wide (1 per forest)Controls adding/removing domains from the forest
PDC EmulatorPer domain (1 per domain)Password changes synchronization, time source, legacy clients, account lockout processing
RID MasterPer domain (1 per domain)Allocates pools of Relative IDs (RIDs) to DCs so each object gets a unique SID
Infrastructure MasterPer domain (1 per domain)Maintains references to objects in other domains (cross-domain group membership)
# View which DC holds each FSMO role
netdom query fsmo

# PowerShell way
Get-ADDomain | Select-Object PDCEmulator, RIDMaster, InfrastructureMaster
Get-ADForest | Select-Object SchemaMaster, DomainNamingMaster

# Transfer a FSMO role (graceful transfer — old DC still online)
Move-ADDirectoryServerOperationMasterRole -Identity "SRV-DC02" -OperationMasterRole PDCEmulator

# Seize a FSMO role (use only if old DC is dead and cannot be recovered)
# ntdsutil → roles → connections → connect to server SRV-DC02 → quit → seize pdc

12. Troubleshooting Active Directory

ProblemCommand / ToolWhat to Look For
Cannot find DCnltest /dsgetdc:lab.localReturns DC name and IP — if fails, DNS or network issue
Replication errorsrepadmin /replsummaryNon-zero failure count between DC pairs
DC health checkdcdiag /test:all /vAll tests should show "passed" — investigate any failures
DNS for AD checkdcdiag /test:DNSValidates SRV records, dynamic update, forwarders
SYSVOL replicationdfsrdiag ReplicationStateShould show "Idle" — "Busy" is OK temporarily
Netlogon servicenltest /sc_verify:lab.localSecure channel verification between member and DC
Time sync issuew32tm /query /statusKerberos requires time within 5 minutes of DC — check source
Kerberos testklistView current Kerberos tickets — klist purge clears cached tickets
# Complete AD health check sequence
dcdiag /test:all /v > C:\Logs\dcdiag.txt
repadmin /replsummary > C:\Logs\repl.txt
netdom query fsmo

# Check for failed logons in Security log
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4625} -MaxEvents 20 |
  ForEach-Object {
    $xml = [xml]$_.ToXml()
    [PSCustomObject]@{
      Time = $_.TimeCreated
      Account = $xml.Event.EventData.Data[5].'#text'
      WorkstationName = $xml.Event.EventData.Data[13].'#text'
      FailureReason = $xml.Event.EventData.Data[8].'#text'
    }
  } | Format-Table -AutoSize

Lesson 2 Complete

You now understand Active Directory structure, how to install and promote a DC, manage users and groups using AGDLP, build OU hierarchies, delegate control, and troubleshoot AD issues.

Next: PowerShell Administration →

📌 Study Checklist