Computer renaming but not updating Domain Controller ( Active Directory )

Recently trying to rename a computer in a multi Domain Controller Enviroment , the device renamed howvever on reboot didn’t show the new PC Name

Using the below powershell I was about to query 10 domain controllers and work out it was updating on one and not the other

repadmin /replsummary

Showed issue with replication on that server , rebooting it fixed this

# Import the Active Directory module
Import-Module ActiveDirectory

# Get all domain controllers in the domain
$domainControllers = Get-ADDomainController -Filter * | Select-Object -ExpandProperty HostName

# Old computer name to query (update if different)
$computerName = "ISTESTH"

# Loop through each domain controller and query the computer object
foreach ($dc in $domainControllers) {
    Write-Host "Querying DC: $dc"
    
    try {
        $computer = Get-ADComputer -Identity $computerName -Server $dc -ErrorAction Stop
        Write-Host "  Found computer object: $($computer.DistinguishedName)"
        Write-Host "  Name: $($computer.Name)"
        Write-Host "  SID: $($computer.SID)"
        Write-Host "  Last Modified: $($computer.Modified)"
    }
    catch {
        Write-Host "  Error: $($_.Exception.Message)" -ForegroundColor Red
    }
    Write-Host "------------------------"
}
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...