HOW TO: Setup Active Directory Domain Services (AD DS) in Windows 2012 Using PowerShell

If you're looking to create an unattended installation scenario for Active Directory, one approach would be to script your installation using PowerShell. This article describes the installation steps for Active Directory Domain Services. While originally written for Server 2012, these steps remain the standard for modern Windows Server deployments.

2026 Update: For modern deployments (Windows Server 2022/2025), ensure your Forest and Domain functional levels are set to at least Win2016 or Win2025.

Preparation Steps for All Future Domain Controllers

1. Set Timezone Appropriately Using tzutil

tzutil /s "Eastern Standard Time"

2. Install AD DS Windows Role

Install-WindowsFeature -name AD-Domain-Services -IncludeManagementTools

3. Ensure AD DS Windows Service is set to Automatic

Set-Service -Name "NTDS" -StartupType "Automatic"

Configuring the Initial Domain Controller (New Forest)

The following script handles the promotion of the first DC. Note the DomainMode and ForestMode parameters—these define the minimum OS version allowed for future DCs in this forest.

$secureRestoreModePassword = ConvertTo-SecureString -string "<<Password>>" -AsPlainText -Force

Install-ADDSForest `
  -CreateDnsDelegation:$false `
  -DatabasePath "D:\Windows\NTDS" `
  -DomainMode Win2025 `
  -DomainName "corp.contoso.local" `
  -DomainNetbiosName "CORP" `
  -ForestMode Win2025 `
  -InstallDNS:$true `
  -LogPath "D:\Windows\NTDS" `
  -NoRebootOnCompletion:$false `
  -SafeModeAdministratorPassword $secureRestoreModePassword `
  -SysvolPath "D:\Windows\SYSVOL" `
  -Force:$true

Modern Note: Starting with Windows Server 2025, Active Directory now supports 32k page sizes for

Author’s Note: This article reflects my personal professional experience and opinions. While my insights are informed by my professional history, these views are my own and do not represent the official position of my former employer.

About the Author: Jacob Marks is an engineering leader with over 20 years of experience, including a decade at Amazon Web Services (AWS) where he led teams in EC2 Core Platform and the development of the AWS Payment Cryptography service.

Labels

.NET .NET 10 .NET 3.5 Active Directory AD DS Adoption AI AI coding AI Ethics AI Hype Alerts Amazon Cognito Amazon DLM Amazon Q Anthropic AppDomain Architecture Artificial Intelligence Asia Pacific Sydney ASP.net ASPxGridView Audit Readiness Auto Recovery Automation AWS AWS Certified AWS Lambda AWS Payment Cryptography AWS SDK AWS Security Specialty Azure Azure DevOps Server Backup BIG-IP C# Career Growth Cartes Bancaires CB Certificate Bundle Certification Claude Cloud Cloud Certification Cloud Hosting Cloud Security CloudWatch CLR Content Query Cost Optimization Credentials CyberChef Database Defense Industry Deloitte Developer Tools Developers DevEx DevExpress DevOps DISA Disk Space DISM Distributed Systems DoD DoD CC SRG DUKPT EBS EC2 Engineering Engineering Leadership Engineering Management EnPasFltV2 Enterprise Event Receiver Exam F5 Federal IT FedRAMP Fintech FISMA GAC Generative AI GitHub gMSA GovCloud Government Compliance GridView Hardware Security Modules HSM IAM Identity Management IIS Infra Infrastructure as Code IT Tools Jacob Marks JavaScript jQuery Lambda Leadership Linqpad LLM lsass.exe LTM Memory Optimization Mentorship Microsoft Migration Multi-Region Keys NACL Native AOT Network Architecture Networking NIST ODBC Open Source Payment Cryptography Payments PCI Compliance Performance Platform Platform Architecture Power Tools PowerShell Python re:Invent Reachability Analyzer Redshift Relationships List Replace Root Volume SAA-C00 SAP-C00 Security Security Group Serverless SES SharePoint SharePoint 2010 Site Reliability SMTP Snapshot Software Engineering Solutions Architect Solutions Architect Professional SP 2007 SPAWAR SSL STIG Storage Strategy Sydney SysAdmin Team Foundation Server Team Utilities Tech Industry Technical Depth Technology TFS Tools Troubleshooting Upgrade Visual Studio VPC VPC Flow Logs Web Development WebPart WinDirStat Windows Server Windows Server 2025 WinForms