Tuesday, May 5, 2015

Active Directory Quick Deployment scripts in Windows 2012 R2 – New/Add

Had to build domain controllers often for production and testing. These are my handy scripts which i use to add domain controllers or build fresh environments in production, and to quickly build labs for testing purposes.

Hope it will be useful for everyone.  Will be covering building new domain controller and adding a domain controller.
Lets see how to build a new Domain Controller and add a additional domain controller – with the Quick Script
Download the Scripts
Step1:
Login to the first machine to build a first domain controller in the environment.
Open PowerShell – Run
.\new-domainccontroller.ps1
NOTE : Open the Script and add your domain name and NETBIOS Name,
Good to know : Script will be building a domain with 2012R2 forest/domain functional level.
image
Step2:
Enter Safemodeadministratorpassword
and confirm it.
image
image
After Rebooting automatically – Domain Controller is READY !!
Start – Run – dsa.msc – Just to see AD tools
image
====
Step3:
To Add Domain Controller
Login to the new local machine – Add the machine to the domain. (Hope you already entered Primary DNS IP in the LAN)
$cred = Get-Credential
image

$creds = Get-credential
Add-Computer -DomainName testexchange.biz –credential $Creds –Restart
Machine will add to the domain after reboot.
Step4:
Run –
.\Add-DomainController.ps1
NOTE : Open the Script and add your domain name.
image
After Reboot – Secondary Domain Controller is added.
image
Download the Scripts

Original: