When 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:
- Domain name (such as azurecurve.local)
- 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.