domain controller
1 TopicMove and Rename Computer Object Despite Slow DC Syncronization
At my workplace, I configure properties of computer objects in my domain using PowerShell. Specifically, I change the name of a computer, then move it to its respective organizational unit. Seems simple enough, right? Unfortunately, my Powershell script only works intermittently due to domain controllers not syncing fast enough? Allow me to explain exactly what happens by showing commands. Note that each command works fine when run separately. $computername = 'oldname' $newcomputername = 'newname' $path = 'someworkingpath' Rename-Computer -ComputerName $computername -NewName $newcomputername -DomainCredential $credential -Restart Get-ADComputer -ComputerName $newcomputername | Move-ADObject -TargetPath $Path After Rename-Computer is executed, the name is changed, but changes are slow to synchronize across the 10 other domain controllers in my domain. Then once Get-ADComputer is executed, the newcomputername cannot be located. Changing the Get-ADComputer command to get the $oldcomputername causes strange behavior. Given that I do not have access to change domain controller settings myself, is there anything I can do to make these commands run one after the other despite having domain controllers that are slow to sync?2.1KViews0likes1Comment