Forum Discussion
SteveBurro
May 09, 2023Copper Contributor
Re-using computer account with Add-Computer
I am having an issue getting computers to rejoin the domain after they are reimaged. It has been working up until Windows 11 22H2. I found that KB5020276 changed re-using computer names, I have done ...
SteveBurro
May 09, 2023Copper Contributor
If I delete the computer object it will create the computer and join to the domain no problem. But I have computers assigned to groups and if I delete the computers they lose their memberships.
May 09, 2023
not delete them , just right click on the computer object and click on reset account , it will allow you to join the machine with the same name to the AD
- SteveBurroMay 10, 2023Copper ContributorResetting the computer account in AD does not fix the issue.
- May 10, 2023did you apply the Sysprep /generalize on your custom image when your built it
- SteveBurroMay 10, 2023Copper ContributorIt defeats the purpose of reimaging in the field if the tech has to going into AD and reset the computer every time they reimage a computer.
- FatherDivineJul 07, 2025Copper Contributor
Just as an update to anyone who may endd up here via search. One method that should work in theory (and I will be testing shortly) is an "if loop" before add-computer. That loop searches the AD OU for the object , and if existant deletes then adds it. If non existant just runs add-computer.
This works well in environments that use full automation (eg a service account that does all object creation and joining so it can get around modern windows AD hardening requiring the same user to join AD that created the object in AD). Also in a script (like mine) that deciphers the hostname to know what OU it belongs, it'll search just that specific OU if the computer object already exists there.