This page looks best with JavaScript enabled

Active Directory Domain Controller Deployment with Powershell

 ·  ☕ 2 min read

Rename the Server

1
2
3
PS C:\Users\Administrator> Rename-Computer XOGS-E-DC01
WARNING: The changes will take effect after you restart the computer XOGS-DC01.
PS C:\Users\Administrator> Restart-Computer

Wait for the server to reboot.

1
PS C:\Users\Administrator> hostname XOGS-E-DC01

Install ADDC Role

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
PS C:\Users\Administrator> Install-windowsfeature -name AD-Domain-Services -IncludeManagementTools

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {Active Directory Domain Services, Group P...

PS C:\Users\Administrator> Get-WindowsFeature | Format-List Name,InstallState


Name         : AD-Certificate
InstallState : Available

Name         : ADCS-Cert-Authority
InstallState : Available

Name         : ADCS-Enroll-Web-Pol
InstallState : Available

Name         : ADCS-Enroll-Web-Svc
InstallState : Available

Name         : ADCS-Web-Enrollment
InstallState : Available

Name         : ADCS-Device-Enrollment
InstallState : Available

Name         : ADCS-Online-Cert
InstallState : Available

Name         : AD-Domain-Services
InstallState : Installed

Name         : ADFS-Federation
InstallState : Available

Name         : ADLDS
InstallState : Available

Promote the Server to Domain Controller

Firstly, use the Test cmdlets to run prerequisite checks for the installation. If this is a real deployment, please use a strong password.

1
2
3
4
5
PS C:\Users\Administrator> Test-ADDSForestInstallation -DomainName lab.xogs.io -SafeModeAdministratorPassword (ConvertTo-SecureString -String "P@55w0rd1" -AsPlainText -Force)
<-- OMITTED -->
Message                          Context                                  RebootRequired  Status
-------                          -------                                  --------------  ------
Operation completed successfully Test.VerifyDcPromoCore.DCPromo.General.3          False Success

If the operation was successful run the installation for real. If this is a real deployment, please use a strong password.

PS C:\Users\Administrator> Install-ADDSForest -DomainName lab.xogs.io -SafeModeAdministratorPassword (ConvertTo-SecureString -String "P@55w0rd1" -AsPlainText -Force)
The target server will be configured as a domain controller and restarted when this operation is complete.
Do you want to continue with this operation?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

After the server has rebooted, we can check the DCs configured in the lab.xogs.io domain where we should see our newly promoted DC.

1
2
3
4
PS C:\Users\Administrator> Get-ADDomainController | Format-List Name,Domain,IPv4Address
Name        : XOGS-E-DC01
Domain      : lab.xogs.io
IPv4Address : 10.10.0.5
Share on

Dean Tognolini
WRITTEN BY
Dean Tognolini
Network Engineer and other stuff