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?

If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.

Your Name

Your Email

Suggested Topic

Suggestion Details

Looking for support or consultancy with Microsoft Dynamics GP?

I no longer work with Microsoft Dynamics GP, but the last company I worked for was ISC Software in the UK; if you’re looking for support or consultancy services with Microsoft Dynamics GP you can contact them here.

Leave a Reply

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