Windows Server Domain Setup and Management Guide
This guide covers setting up an Active Directory domain, connecting Windows machines, managing domain accounts, implementing security policies, and monitoring your domain environment.
1. Introduction to Active Directory Domain Services
Active Directory Domain Services (AD DS) provides centralized authentication, authorization, and directory services for Windows-based environments. Key benefits include:
- Centralized user and computer management
- Single sign-on across domain resources
- Group Policy implementation
- Resource delegation and security
2. Setting up a Domain Controller
Hardware Requirements
For a production domain controller, ensure your server meets these minimum requirements:
- Processor: 1.4 GHz 64-bit processor (2+ cores recommended)
- RAM: 4 GB minimum (8+ GB recommended)
- Storage: 80 GB minimum (SSD recommended)
- Network: Gigabit Ethernet
- Static IP address
Pre-installation Tasks
- Install Windows Server according to the instructions in mssvr-step-1.md
- Apply security hardening as outlined in mssvr-step-2.md
- Configure a static IP address
- Set an appropriate computer name
- Install all available Windows updates
3. Installing Active Directory and Promoting to Domain Controller
Install AD DS Role
- Log in to the server with administrator credentials
- Open Server Manager
- Click Manage > Add Roles and Features
- In the wizard, select Role-based or feature-based installation
- Select the local server
- From the list of roles, check Active Directory Domain Services
- Click Add Features when prompted for additional features
- Continue through the wizard, accepting the defaults
- Click Install and wait for the installation to complete
Promote Server to Domain Controller
- From Server Manager, click the notification flag with a yellow warning icon
- Click Promote this server to a domain controller
- Select Add a new forest and enter your root domain name (e.g.,
company.local) - Choose a Forest and Domain functional level (typically the highest available)
- Set the Domain Controller options:
- Ensure DNS Server is checked
- Enter and confirm the DSRM (Directory Services Restore Mode) password
- Ignore DNS delegation warnings (for a new forest)
- Verify or change the NetBIOS domain name
- Accept or modify the default paths for the database, logs, and SYSVOL folders
- Review the options and click Next
- When prerequisite checks are complete, click Install
- The server will automatically restart after installation
# Alternative: Install AD DS and promote to DC using PowerShell
Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
# Create a new forest
Install-ADDSForest `
-DomainName "company.local" `
-DomainNetbiosName "COMPANY" `
-ForestMode "WinThreshold" `
-DomainMode "WinThreshold" `
-InstallDns:$true `
-NoRebootOnCompletion:$false `
-Force:$true4. Adding Windows Machines to the Domain
Preparing for Domain Join
Before joining any machine to the domain, ensure the following:
- The machine can resolve DNS to the domain controller
- Network connectivity exists between the machine and domain controller
- Required ports are open (53/TCP/UDP, 88/TCP/UDP, 389/TCP/UDP, etc.)
- The machine has a unique computer name
Joining a Windows Server to the Domain
- Log in to the server with local administrator credentials
- Open System Properties:
- Right-click Start > System > Advanced system settings
- Or run
sysdm.cplfrom the Run prompt
- On the Computer Name tab, click Change
- In the Computer Name/Domain Changes dialog:
- Select Domain
- Enter the domain name (e.g.,
company.local) - Click OK
- When prompted, enter domain administrator credentials
- Restart the server when prompted
Joining a Windows Client to the Domain
- On the Windows client, open Settings > Accounts > Access work or school
- Click Connect
- Click Join this device to a local Active Directory domain
- Enter the domain name and click Next
- Enter domain administrator credentials when prompted
- Choose whether to add a domain user as a local administrator
- Restart the computer when prompted
# Alternative: Join a machine to the domain using PowerShell
Add-Computer -DomainName "company.local" -Credential (Get-Credential) -Restart5. Managing Domain Accounts
Creating User Accounts
Through Active Directory Administrative Center (ADAC)
- On the domain controller, open Server Manager > Tools > Active Directory Administrative Center
- In ADAC, click on the domain (e.g.,
company.local) - Navigate to the appropriate container (e.g., Users)
- In the right pane, click New > User
- Fill in the required fields:
- First name, Last name
- User UPN logon (e.g., user@company.local)
- User SamAccountName logon (pre-Windows 2000 logon)
- Password and confirmation
- Set password options as needed
- Click OK to create the user
Through PowerShell
# Create a new user account
New-ADUser `
-Name "John Smith" `
-GivenName "John" `
-Surname "Smith" `
-SamAccountName "jsmith" `
-UserPrincipalName "jsmith@company.local" `
-AccountPassword (ConvertTo-SecureString "P@ssw0rd123!" -AsPlainText -Force) `
-Enabled $true `
-ChangePasswordAtLogon $true `
-Path "CN=Users,DC=company,DC=local"Creating and Managing Groups
Creating Security Groups
- Open Active Directory Users and Computers (ADUC)
- Navigate to the appropriate container (e.g., Users)
- Right-click > New > Group
- Enter a group name
- Select the group scope:
- Domain local
- Global
- Universal
- Select the group type (typically Security)
- Click OK
Adding Members to Groups
- In ADUC, right-click the group > Properties
- Go to the Members tab
- Click Add
- Enter the user names to add and click Check Names
- Click OK twice to save
# Create a new security group via PowerShell
New-ADGroup `
-Name "IT Staff" `
-SamAccountName "ITStaff" `
-GroupCategory Security `
-GroupScope Global `
-Path "CN=Users,DC=company,DC=local"
# Add a user to the group
Add-ADGroupMember -Identity "ITStaff" -Members "jsmith"Creating Organizational Units (OUs)
- In ADUC, right-click the domain > New > Organizational Unit
- Enter a name for the OU
- Click OK
- You can now move users, groups, and computers into this OU
# Create a new Organizational Unit via PowerShell
New-ADOrganizationalUnit `
-Name "Marketing" `
-Path "DC=company,DC=local" `
-ProtectedFromAccidentalDeletion $true6. Applying Security Policies
Group Policy Basics
Group Policy Objects (GPOs) allow you to apply and enforce settings across your domain. They can be linked to:
- Entire domains
- Organizational Units (OUs)
- Sites
Creating and Configuring GPOs
- On the domain controller, open Server Manager > Tools > Group Policy Management
- Expand the forest and domain
- Right-click on Group Policy Objects > New
- Enter a descriptive name for the GPO (e.g., "Workstation Security Settings")
- Right-click the new GPO and select Edit
- The Group Policy Management Editor opens, showing:
- Computer Configuration (for computer policies)
- User Configuration (for user policies)
Common Security Policies
Password Policies
- In the Group Policy Management Editor, navigate to: Computer Configuration > Policies > Windows Settings > Security Settings > Account Policies > Password Policy
- Configure settings such as:
- Enforce password history
- Maximum password age
- Minimum password length
- Password complexity requirements
Account Lockout Policies
- Navigate to Account Lockout Policy in the same section
- Configure:
- Account lockout threshold
- Account lockout duration
- Reset account lockout counter after
Audit Policies
- Navigate to Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policy Configuration
- Configure detailed auditing for events like:
- Account logon events
- Account management
- Logon events
- Policy changes
Linking and Testing GPOs
- In the Group Policy Management console, drag the GPO to the domain or OU
- Right-click the link and select Link Enabled to activate it
- Test the policy by running the following command on a target machine:
gpupdate /force - Verify policy application with:
gpresult /r
7. Monitoring and Auditing
Setting Up Security Monitoring
Configuring Event Log Settings
- Create a GPO for event log configuration
- Edit the GPO and navigate to Computer Configuration > Policies > Administrative Templates > Windows Components > Event Log Service
- Configure settings for:
- Maximum log size
- Retention method
- Access rights
Implementing Centralized Event Collection
- Install Windows Event Collector service on a monitoring server
- Configure subscription for forwarding events from domain computers
- Create a GPO to enable Windows Event Forwarding on all client computers
# Configure event forwarding on collector server
wecutil qc /q
# Create an event subscription
$xml = @"
<Subscription xmlns="http://schemas.microsoft.com/2006/03/windows/events/subscription">
<SubscriptionId>Security Events</SubscriptionId>
<SubscriptionType>SourceInitiated</SubscriptionType>
<Description>Collects security events from domain computers</Description>
<Enabled>true</Enabled>
<Uri>http://schemas.microsoft.com/wbem/wsman/1/windows/EventLog</Uri>
<ConfigurationMode>Normal</ConfigurationMode>
<Query><![CDATA[
<QueryList>
<Query Id="0">
<Select Path="Security">*[System[(Level=1 or Level=2 or Level=3)]]</Select>
</Query>
</QueryList>
]]></Query>
<ReadExistingEvents>false</ReadExistingEvents>
<TransportName>HTTP</TransportName>
<ContentFormat>RenderedText</ContentFormat>
<Locale Language="en-US"/>
<LogFile>ForwardedEvents</LogFile>
<PublisherName>Microsoft-Windows-EventCollector</PublisherName>
<AllowedSourceDomainComputers>O:NSG:BAD:P(A;;GA;;;DC)S:</AllowedSourceDomainComputers>
</Subscription>
"@
$xml | Out-File -FilePath "C:\EventSubscription.xml" -Encoding ASCII
wecutil cs "C:\EventSubscription.xml"Implementing Regular Monitoring Practices
Essential Areas to Monitor
- Security Events: Failed logons, privilege use, account management
- System Performance: CPU, memory, disk usage
- Service Status: Critical services running/stopped
- Active Directory Health: Replication, SYSVOL, DNS
Regular Maintenance Tasks
- Review security logs daily
- Monitor user account status (locked, disabled, expired)
- Check for unauthorized privilege escalation
- Verify backup status and test restores
- Monitor for unauthorized changes to Group Policy
Advanced Monitoring Solutions
Consider implementing more comprehensive monitoring with:
- Microsoft Operations Management Suite (OMS)
- System Center Operations Manager (SCOM)
- Azure Security Center (for hybrid environments)
- Third-party SIEM solutions like Splunk, QRadar, or Wazuh
8. Domain Maintenance and Best Practices
Regular Maintenance Tasks
Backup Active Directory: Schedule regular system state backups
powershellWbadmin start systemstatebackup -backuptarget:E:Check Domain Health: Run DCDIAG regularly
powershelldcdiag /vVerify Replication (for multiple DCs)
powershellrepadmin /replsummaryClean up Stale Objects:
- Inactive computer accounts
- Disabled user accounts
- Empty groups
Update Domain Controllers:
- Apply Windows updates monthly
- Follow a staged approach for critical servers
Security Best Practices
Secure Domain Admin Accounts:
- Use separate accounts for administrative tasks
- Implement time-based access
- Restrict logon workstations
Implement Tiered Administration Model:
- Tier 0: Domain controllers, enterprise admins
- Tier 1: Server administrators
- Tier 2: Workstation support
Apply the Principle of Least Privilege:
- Grant only necessary permissions
- Use role-based access control
- Regularly review and audit permissions
Protect Against Credential Theft:
- Implement Protected Users security group
- Enable Credential Guard on supported systems
- Use Group Managed Service Accounts (gMSAs) for services
Monitor for Indicators of Compromise:
- Unusual logon patterns
- Suspicious account modifications
- Unexpected privilege escalation
Conclusion
Setting up and managing a Windows Server domain environment requires careful planning and ongoing maintenance. By following these best practices for installation, security, and monitoring, you can create a secure and reliable domain infrastructure that supports your organization's needs.
For further information, refer to Microsoft's official documentation and security baselines.