Step-By-Step: Harnessing PowerShell to Build A New Active Directory Forest
Following a recent post on CANITPRO.NET entitled Benefits of Deploying Windows Server 2012 R2 Core Installation, I thought it would be a great opportunity to provide insight as to harnessing PowerShell to assist in the day to day activities that could be completed on a core enabled server. This script could prove to be useful when setting up self service scripts for people setting up their own environment.
Note: This script can actually be utilized in any of the modes offered by Windows Server 2012 R2.
Step 2: Launch PowerShell from the server you are setting up as your first DC in the new forest then enter the following:
Add-WindowsFeature -name ad-domain-service -IncludeManagementTools
Step 3: Once the process is completed and the role is installed, enter the following command to configure the new forest:
Install-ADDSForest -DomainName "contoso.com" -ForestMode 5 -DomainMode 5
This creates a new Active Directory forest under the Contoso.com domain with forest functional and domain functional mode enable via Server 2012 R2.
Note: The following functional level requirements listed below are available to those that require different modes.
- Windows Server 2003 functional level: 2
- Windows Server 2008 functional level: 3
- Windows Server 2008 R2 functional level: 4
- Windows Server 2012 functional level: 5
- Windows Server 2012 R2 functional level: 6
Step 4: The server will now prompt for a safemode password thus creating a Active Directory recovery password.
Step 5: Provide confirmation in regards to installing Active Directory and configure this server as a domain controller by clicking Y on the keyboard.
The server will then reboot once the process is completed.
With the recent upgrade to PowerShell 4.0 available and resources such as the Microsoft Virtual Academy, be sure to fully take advantage of the robustness a core server core installation has to offer.