Here is a GUI for Active Directory metadata cleanup process. The utility removes Active Directory domain controller metadata left behind after a domain controller is removed improperly or unsuccessfully. This script has been test and verified by the Microsoft Script Center Team.
You can down this script from the following location:
More info on Metadata Cleanup:
Update – Metadata cleanup in Windows 2008 and Windows 2008 R2
In Windows 2008 and Windows 2008 R2, you can use Remote Server Administration Tools (RSAT) or the Active Directory Users and Computers console (Dsa.msc) that is included with Windows Server 2008 or Windows Server 2008 R2 to delete a domain controller computer account from the Domain Controllers organizational unit (OU), the cleanup of server metadata is performed automatically. You don’t have to perform a separate metadata cleanup procedure.
You can also use the Active Directory Sites and Services console (Dssite.msc) to delete a domain controller’s computer account, which also completes metadata cleanup automatically. However, Active Directory Sites and Services removes the metadata automatically only when you first delete the NTDS Settings object below the computer account in Dssite.msc.
Read more info - http://technet.microsoft.com/en-us/library/cc816907(WS.10).aspx