Share via

Powershell script

jay k 21 Reputation points
2023-08-20T11:23:26.27+00:00

Can you pls help with the script to promote multiple windows 2022 servers as domain controllers with post promotion test in existing domain. post tests for checking DNS, Sysvol replication and replication partner with link details.

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Server | User experience | PowerShell

2 answers

Sort by: Most helpful
  1. jay k 21 Reputation points
    2023-08-24T07:54:57.63+00:00

    Thanks for your response, I am looking for the script to add additional domain controllers. AD forest is already installed. I have a below script to promote singe DC, but getting error with authentication.

    cls

    $domainname="abc.net"

    $newdcname= Read-Host -Prompt "Enter new DC name"

    $newdcip= Read-Host -Prompt "Enter new DC IP Address"

    $admincredentails= Get-Credential

    Install-WindowsFeature -Name AD-Domain-services -IncludeManagementTools

    Install-ADDSdomaincontroller -noglobalcatalog:$false -CreateDnsDelegation:$false -Criticalreplicationonly:$false -Databasepath "c:\Windows\NTDS" -Domainname $domainname -installdns:$true -Logpath "c:\Windows\NTDS" -Norebootoncompletion:$false -Sysvolpath "c:\windows\SYSVOL" -Force:$true -Confirm:$false

    Write-Host "New Domain Controller promotion completed"

    0 comments No comments

  2. Limitless Technology 45,226 Reputation points
    2023-08-21T13:00:38.3166667+00:00

    Hello there,

    As you have not posted any script you can find the below script as sample but it is not tested.

    Define the domain name and administrator credentials

    $DomainName = "yourdomain.local"

    $DomainAdminUser = "yourdomainadmin"

    $DomainAdminPassword = ConvertTo-SecureString "yourpassword" -AsPlainText -Force

    $Credential = New-Object System.Management.Automation.PSCredential ($DomainAdminUser, $DomainAdminPassword)

    Define the name and IP address of the new domain controllers

    $DC1Name = "DC1"

    $DC1IPAddress = "192.168.1.2"

    $DC2Name = "DC2"

    $DC2IPAddress = "192.168.1.3"

    Install Active Directory Domain Services and promote the new domain controllers

    Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools

    Install-ADDSForest -DomainName $DomainName -DomainNetbiosName ($DomainName.Split('.')[0]) -InstallDns -Credential $Credential -Force -Verbose

    Wait for Active Directory services to install and promote

    Start-Sleep -Seconds 10

    Restart the new domain controllers (recommended)

    Restart-Computer -Force

    Perform post-promotion tests

    Test DNS resolution

    Test-DnsServer -IPAddress $DC1IPAddress

    Test-DnsServer -IPAddress $DC2IPAddress

    Test Sysvol replication

    Get-ADReplicationFailure -Target $DC1Name

    Get-ADReplicationFailure -Target $DC2Name

    List replication partners

    Get-ADReplicationPartnerMetadata -Target $DC1Name

    Get-ADReplicationPartnerMetadata -Target $DC2Name

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer–


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.