Q. What is simple PowerShell to quickly create a new domain?
A. The PowerShell below will create a new domain and forest based on the values configured in the variables. It will make itself a DNS server but will not alter its local DNS configuration. if you want the local DNS updated remove the -SkipAutoConfigureDNS parameter in the example below.
Import-Module "Servermanager" #For Add-WindowsFeature
Add-WindowsFeature AD-Domain-Services, DNS -IncludeManagementTools
$netbiosname = 'POCDom'
$fqdomname = 'pocdom.local'
$NTDSPath = 'e:\ntds'
$NTDSLogPath = 'e:\ntdslogs'
$SYSVOLPath = 'e:\sysvol'
$SafePassPlain = 'Pa55word'
$SafePass = ConvertTo-SecureString -string $SafePassPlain `
-AsPlainText -force
Install-ADDSForest -DomainName $fqdomname -DomainNetBIOSName $netbiosname `
-SafemodeAdministratorPassword $SafePass -SkipAutoConfigureDNS -SkipPreChecks `
-InstallDNS:$true -SYSVOLPath $SysvolPath -DatabasePath $NTDSPath -LogPath $NTDSLogpath `
-Force
0 comments
Hide comments