PowerShell to Promote Domain Controller

Windows ServerWhen testing Microsoft Dynamics GP, I often need a domain controller within my set of virtual machines. I’ve been promoting a server to be a domain controller manually, but it recently occurred to me that I could probably do the same task using PowerShell.

After doing some research, I came up with four commands which will rename and restart the server, install the Active Directory feature and add a forest.

To rename a server, run the following command, replacing the highligted section with the new server name:

Rename-computer -newname {server name}

After renaming a server, it needs to be rebooted; the following command will do this:

Restart-Computer

The Active Directory Domain Services Windows Feature need to be installed:

Install-WindowsFeature AD-Domain-Services -IncludeManagementTools

The final step in promoting the server to be a domain controller, is to add the forest.

There are two elements which need to be defined:

  1. Domain name (such as azurecurve.local)
  2. NETBIOS (such as AZRCRV)
Install-ADDSForest -DomainName {domain name} -DomainNetbiosName {netbios}

With the four commands run, the promotion to domain controller will be complete.

What should we write about next?





Your Name (required) –
Your Email (required) –

Leave a Reply

Your email address will not be published. Required fields are marked *