How clean is deleting a computer object?

Posted by Kevin on Server Fault See other posts from Server Fault or by Kevin
Published on 2012-11-13T08:17:25Z Indexed on 2012/11/14 5:02 UTC
Read the original article Hit count: 433

Filed under:

Though quite skilled at software development, I'm a novice when it comes to Active Directory.

I've noticed that AD seems to have a lot of stuff buried in the directory and schema which does not appear superficially when using simplified tools such as Active Directory Users and Computers. It kind of feels like the Windows registry, where COM classes have all kinds of intertwined references, many of which are purely by GUID, such that it's not enough to just search for anything referencing "GadgetXyz" by name in order to cleanly remove GadgetXyz. This occasionally leads to the uneasy feeling that I may have useless garbage building up in there which I have no idea how to weed out.

For instance, I made the mistake a while back of trying to rename a DC, figuring I could just do it in the usual manner from Control Panel. I found references to the old name buried all over the place which made it impossible to reuse that name without considerable manual cleanup. Even long after I got it all working, I've stumbled upon the old name hidden away in LDAP. (There were no other DCs left in the picture at that time so I don't think it was a tombstone issue.)

More specifically, I'm worried about the case of just outright deleting a computer from AD. I understand the cleanest way to do it is to log into the computer itself and tell it to leave the domain. (As an aside, doing this in Windows 8 seems to only disable the computer object and not delete it outright!) My concern is cases where this is not possible, for instance because it was on an already-deleted VM image.

I can simply go into Active Directory Users and Computers, find the computer object, click it, and press Delete, and it seems to go away. My question is, is it totally, totally gone, or could this leave hanging references in any Active Directory nook or cranny I won't know to look in? (Excluding of course the expected tombstone records which expire after a set time.) If so, is there any good way to clean up the mess?

Thank you for any insight!

Kevin

ps.,

It was over a year ago so I don't remember the exact details, but here's the gist of the DC renaming issue. I started with a single 2008 DC named ABC in a physical machine and wanted to end up instead with a DC of the same name running in a vSphere VM. Not wanting to mess with imaging the physical machine, my plan instead was:

  1. Rename ABC to XYZ.

  2. Fresh install 2008 on a VM, name it ABC, and join it to the domain. (I may have done the latter in the same step as promoting to DC; I don't recall.)

  3. dcpromo the new ABC as a 2nd DC, including GC.

  4. Make sure the new ABC replicated correctly from XYZ and then transfer the FSMO roles from XYZ to it.

  5. Once everything was confirmed to work with the new ABC alone, demote XYZ, remove the AD role, and remove it from the domain.

Eventually I managed to do this but it was a much bumpier ride than expected.

In particular, I got errors trying to join the new ABC to the domain. These included "The pre-windows 2000 name is already in use" and "No mapping between account names and security IDs was done."

I eventually found that the computer object for XYZ had attributes that still referred to it as ABC. Among these were servicePrincipalName, msDS-AdditionalDnsHostName, and msDS-AdditionalSamAccountName. The latter I could not edit via Attribute Editor and instead had to run this against XYZ:

NETDOM computername <simple-name> /add:<FQDN>

There were some other hitches I don't remember exactly.

© Server Fault or respective owner

Related posts about active-directory