Active Directory Domain Services using PowerShell

In this tutorial we will see how to install Active Directory Domain Services (ADDS) using PowerShell.

Below are the steps we need to follow for installing ADDS

  1. Set IP Address DNS and Gateway – (Link here)
  2. Set/Change Computer Name – (Rename-Computer ComputerName)
  3. Set Firewall off.
  4. Install ADDS service
  5. Install DNS service
  6. Complete post configuration for ADDS

Run PowerShell as Administrator

1. Rename Computer name:

In my example I will set computer name as ‘PDC01’. For this use ‘Rename-ComputerName’ cmdlet. Restart computer in order to reflect it.

Rename-ComputerName ‘PDC01’

PowerShell

2. Now let’s check if the ADDS is available to install:

For this use below cmdlet

Get-WindowsFeature | where-object Name -Like *Domain*

The wild-cards(*) character represents any characters that appear before and after “Domain” word

PowerShell

The ‘Install State’ in above image shows the ADDS is ‘Available’ for installation

3. Now let’s install this service:

For this use cmdlet ‘Install-WindowsFeature’ with Name parameter. Remember to include management tools parameter.

Install-WindowsFeature
-Name AD-Domain-Services
-IncludeManagementTools

PowerShell

4. Finally check the ADDS service is installed:

Use the same cmdlet used in 2nd step above:

Get-WindowsFeature | where-object Name -Like *Domain*

The ‘Install State’ should show as ‘Installed’ instead of Available now

PowerShell

5. Now that we have installed ADDS. Its time to install DNS:

To install DNS use below cmdlet.

Install-WindowsFeature -Name DNS
-IncludeManagementTools

PowerShell

6. Post Configuration

Once AD and DNS are installed we need to do post configuration in order assign domain name. To do this setup Forest and give domain name. Use below cmdlet

In this example we will set ‘abc.com’ as a domain name. Rememeber, wheever we add a new domain name in PDC, AD will automatically create a new forest with the same name

Install-ADDSForest -DomainName abc.com

PowerShell

Hit ‘Enter’ as the default is ‘Y’. This will configure the forest and restart your server automatically.

PowerShell

7. Validate the DC is configured:

Get-ADDomainController

PowerShell

PowerShell

Leave a Reply

Your email address will not be published.