Windows PowerShell script for AD DS Deployment.txt - Notepad

Windows PowerShell script for AD DS Deployment

The below script installs the Active Directory Domain Services role, the DNS role, the Active Directory Management features and creates a new root domain in a new forest. It will ask you for all required parameters, run it as Administrator.
#
# Windows PowerShell script for AD DS Deployment
#

# Install the Active Directory Domain Services role and Management Tools
get-windowsfeature AD-Domain-Services | install-windowsfeature
get-windowsfeature RSAT-ADDS | install-windowsfeature

# Import the AD DS Deployment PowerShell Module
Import-Module ADDSDeployment

# Set required Variables
$DomainName = Read-Host "Please enter your DomainName"
$DomainNetbiosName = Read-Host "Please enter your DomainNetbiosName"
Write-Host "Windows Server 2003 (2, Win2003) Windows Server 2008 (3, Win2008), Windows Server 2008 R2 (4, Win2008R2) and Windows Server 2012 (5, Win8)"
$DomainMode = Read-Host "Please enter your DomainMode (e.g. 4 or Win2008R2)"
Write-Host "Windows Server 2003 (2, Win2003) Windows Server 2008 (3, Win2008), Windows Server 2008 R2 (4, Win2008R2) and Windows Server 2012 (5, Win8)"
$ForestMode = Read-Host "Please enter your DomainMode (e.g. 4 or Win2008R2)"
$DatabasePath = Read-Host "Please enter your DatabasePath (e.g. C:\Windows\NTDS)"
$LogPath = Read-Host "Please enter your LogPath (e.g. C:\Windows\NTDS)"
$SysvolPath = Read-Host "Please enter your SysvolPath (e.g. C:\Windows\SYSVOL)"

# Go!
Install-ADDSForest -DomainName "$DomainName" -CreateDnsDelegation:$false -DatabasePath "$DatabasePath" -DomainMode "$DomainMode" -DomainNetbiosName "$DomainNetbiosName" -ForestMode "$ForestMode" -InstallDns:$true -LogPath "$LogPath" -NoRebootOnCompletion -SysvolPath $SysvolPath -Force

Source

Back