Skip to content

Instantly share code, notes, and snippets.

@ScriptingPro
Last active February 1, 2017 05:32
Show Gist options
  • Save ScriptingPro/1eac54183db0149caa681baa3a8e9629 to your computer and use it in GitHub Desktop.
Save ScriptingPro/1eac54183db0149caa681baa3a8e9629 to your computer and use it in GitHub Desktop.
Install Domain Controller Windows Server 2012 R2 Powershell
<#
@scriptingpro
Using powershell to promote a new domain controller
This will Install a new RODC
Todo:
parameterize SafeModeAdministratorPassword (DSRM password)
#>
#First add the Active Directory Domain Services feature to your server
Add-WindowsFeature -name ad-domain-services -IncludeManagementTools
#Import ADDSDeployment
Import-Module ADDSDeployment
# Create hashtable with all properties for the Install-ADDSDomainController cmdlet
$NewDomainController = @{
DomainName = 'corp.contoso.com'
SiteName = 'AustinHeadquarters'
InstallDns = $True
NoGlobalCatalog = $False
CriticalReplicationOnly = $False
DatabasePath = 'D:\Windows\NTDS'
SysvolPath = 'D:\Windows\SYSVOL'
LogPath = 'E:\Windows\NTDS'
ReadOnlyReplica = $True
AllowPasswordReplicationAccountName = @("CONTOSO\Allowed RODC Password Replication Group")
DenyPasswordReplicationAccountName = @("CONTOSO\Denied RODC Password Replication Group", "BUILTIN\Administrators", "BUILTIN\Server Operators", "BUILTIN\Backup Operators", "BUILTIN\Account Operators")
NoRebootOnCompletion = $False
Force = $True
}
#Now install domain controller
Install-ADDSDomainController @NewDomainController -Credential (Get-Credential CONTOSO\adminuser)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment