windows-scripts/ad-slave-init.ps1
2025-05-08 15:03:00 +02:00

33 lines
983 B
PowerShell
Executable File

#$config = Get-Content -Raw -Path ".\config.json" | ConvertFrom-Json
if (-not (Get-WindowsFeature -Name AD-Domain-Services).Installed) {
Write-Host "Le role AD DS n'est pas installer." -ForegroundColor Red
Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
}
if (-not (Get-WindowsFeature -Name DNS).Installed) {
Write-Host "Le role DNS n'est pas installer." -ForegroundColor Red
Install-WindowsFeature -Name DNS -IncludeManagementTools
}
$dom = Read-Host "Domain Parent (nom.local) "
#$net = Read-Host "Nom NetBIOS "
$pwdsafe = Read-Host "DSRM password " -AsSecureString
$creds = Get-Credential
Install-ADDSDomainController `
-DomainName $dom `
-SafeModeAdministratorPassword $pwdsafe `
-Credential $creds `
-InstallDNS $true `
-DatabasePath "C:\Windows\NTDS" `
-LogPath "C:\Windows\NTDS" `
-SYSVOLPath "C:\Windows\SYSVOL" `
-ReplicationSourceDC $dom `
-NoRebootOnCompletion $false `
-Force $true