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.
| Concept | Definition | Example |
|---|---|---|
| Domain | A logical grouping of network objects (users, computers, groups) that share the same AD database, security policies, and trust relationships | company.com, lab.local |
| Forest | One 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 |
| Tree | One or more domains with a contiguous namespace that share a two-way transitive trust | company.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 policies | SRV-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 |
| Schema | Defines 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 |
| Trust | A relationship allowing users in one domain to access resources in another domain | Transitive trust (automatic within forest), external trust (manual) |
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)
# Via PowerShell (fastest method): Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools # Verify installation Get-WindowsFeature -Name AD-Domain-Services
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
C:\Windows\NTDS\ntds.ditC:\Windows\SYSVOL\sysvol\lab.local\ containing GPO templates and scripts, replicated between DCs via DFS-RADUC (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
dsa.msc)| Option | When to Use |
|---|---|
| User must change password at next logon | Default for new accounts — forces user to set their own password |
| User cannot change password | Service accounts, shared accounts |
| Password never expires | Service accounts only — use with strong passwords and monitor carefully |
| Account is disabled | Template accounts, accounts created in advance |
| Tab | Key Settings |
|---|---|
| General | Display name, description, office, phone, email, web page |
| Account | Logon name (UPN), logon hours (restrict to business hours), account expiry, logon workstations, account options |
| Profile | Profile path (roaming profile), logon script, home folder (drive letter + UNC path) |
| Member Of | View and modify group memberships — this is where you add users to groups |
| Dial-in | Remote Access (VPN) permissions — usually set to "Control access through NPS Network Policy" |
| Environment / Sessions / Remote control | Terminal Services / RDS specific settings |
| Scope | Members Can Be From | Used For Resources In | Best Practice Use |
|---|---|---|---|
| Domain Local | Any domain in forest + trusted domains | Same domain only | Resource access groups (e.g., "DL-FileShare-ReadWrite") |
| Global | Same domain only | Any domain in forest | User account groups (e.g., "GG-IT-Department") |
| Universal | Any domain in forest | Any domain in forest | Multi-domain role groups; avoid unless needed (GC replication impact) |
# 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"
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).
# 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
# 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
Delegation lets you grant specific administrative permissions over an OU without giving full Domain Admin rights. This follows the principle of least privilege.
# 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
# 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
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
Certain AD operations must happen on exactly one DC at a time. These are called FSMO (flexible single master operations) roles.
| FSMO Role | Scope | Function |
|---|---|---|
| Schema Master | Forest-wide (1 per forest) | Controls all schema modifications (adding new attributes or object classes) |
| Domain Naming Master | Forest-wide (1 per forest) | Controls adding/removing domains from the forest |
| PDC Emulator | Per domain (1 per domain) | Password changes synchronization, time source, legacy clients, account lockout processing |
| RID Master | Per domain (1 per domain) | Allocates pools of Relative IDs (RIDs) to DCs so each object gets a unique SID |
| Infrastructure Master | Per 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
| Problem | Command / Tool | What to Look For |
|---|---|---|
| Cannot find DC | nltest /dsgetdc:lab.local | Returns DC name and IP — if fails, DNS or network issue |
| Replication errors | repadmin /replsummary | Non-zero failure count between DC pairs |
| DC health check | dcdiag /test:all /v | All tests should show "passed" — investigate any failures |
| DNS for AD check | dcdiag /test:DNS | Validates SRV records, dynamic update, forwarders |
| SYSVOL replication | dfsrdiag ReplicationState | Should show "Idle" — "Busy" is OK temporarily |
| Netlogon service | nltest /sc_verify:lab.local | Secure channel verification between member and DC |
| Time sync issue | w32tm /query /status | Kerberos requires time within 5 minutes of DC — check source |
| Kerberos test | klist | View 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
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.