#rename the computer
Rename-Computer -NewName $dcname -force
#install features
$featureLogPath = "c:\poshlog\featurelog.txt"
New-Item $featureLogPath -ItemType file -Force
$addsTools = "RSAT-AD-Tools"
Add-WindowsFeature $addsTools
Get-WindowsFeature | Where installed >>$featureLogPath
#restart the computer
Restart-Computer
Add-ADFeatures_and_InstallNewForest.ps1 (install the necessary Features for the basic installation of a forest, then Create New Forest and add Domain Controller):
Param(
[Parameter(Mandatory=$false, ValueFromPipeline=$true)][string[]]$domainname = "newdomaine.com", #FQDN name of the new domain
[Parameter(Mandatory=$false, ValueFromPipeline=$true)][string[]]$netbiosName = "newdomaine", #netbios name of the new domain (exl: "newdomaine")
[Parameter(Mandatory=$false, ValueFromPipeline=$true)][string[]]$domMode = "WinThreshold", #mode of the domain installation ("WinThreshold" for Win2016) (*)
[Parameter(Mandatory=$false, ValueFromPipeline=$true)][string[]]$forMode = "Win2012R2" #mode of the forest installation
)
#Install AD DS, DNS and GPMC
$featureLogPath = "c:\poshlog\featurelog.txt"
start-job -Name addFeature -ScriptBlock {
Add-WindowsFeature -Name "ad-domain-services" -IncludeAllSubFeature -IncludeManagementTools
Add-WindowsFeature -Name "dns" -IncludeAllSubFeature -IncludeManagementTools
Add-WindowsFeature -Name "gpmc" -IncludeAllSubFeature -IncludeManagementTools }
Wait-Job -Name addFeature
Get-WindowsFeature | Where installed >>$featureLogPath
(*):
The domain functional level cannot be lower than the forest functional level, but it can be higher. The default is automatically computed and set.
So for a mixed mode, use "Win2012R2" for the ForestMode and "WinThreshold" (for Win2016) for the DomainMode.
ForestMode/DomainMode:
Windows Server 2003: 2 or Win2003
Windows Server 2008: 3 or Win2008
Windows Server 2008 R2: 4 or Win2008R2
Windows Server 2012: 5 or Win2012
Windows Server 2012 R2: 6 or Win2012R2
Windows Server 2016: 7 or WinThreshold
Ceci est ma KB perso. Elle n'a pas but de formation. Je l'alimente au fil de mes pérégrinations. Si elle vous aide tant mieux, sinon rien ne vous empêche de m'interroger ;).
/
This is My Personal Knowledge Base. it is not trained. I nourish it in the course of my peregrinations. If it helps you so much better, if nothing prevents you from questioning me;). But I can not train U, i do not have the time to.
Enjoy!
Commenter cet article