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}