Forcefully demote a Windows Server 2003 domain controller
Here let's go through the procedure to forcefully demote a domain controller (using Windows 2003 SP1 as an example).
1. Click Start, click Run, and then type the following command:
dcpromo /forceremoval
2. Click OK. If Certificate Services is not removed, you will get a message to remove it first. If FSMO roles/GC are not seized from the DC, you will get a message to transfer the roles to another DC.
3. At the Welcome to the Active Directory Installation Wizard page, click Next.
4. At the Force the Removal of Active Directory page, click Next.
5. In Administrator Password, type the password and confirmed password that you want to assign to the Administrator account of the local SAM database, and then click Next.
6. In Summary, click Next.
7. When it finishes, click Finish and reboot the computer.
1. Restart the computer, and then press F8 to display the Windows Advanced Options menu.
2. Choose Directory Services Restore Mode, press ENTER, and then press ENTER again to continue restarting.
3. Modify the ProductType entry in the registry. To do this, follow these steps:
a. Click Start, click Run, type regedit , and then click OK.
b. Locate the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions
c. In the right-pane, double-click ProductType.
d. Type ServerNT in the Value data box, and then click OK.
Note If this value is not set correctly or is misspelled, you may receive the following error message:
System Process - License Violation: The system has detected tampering with your registered product type. This is a violation of your software license. Tampering with product type is not permitted.
e. Quit Registry Editor.
4. Restart the computer.
5. Log on with the administrator account and password that is used for Directory Service Repair mode.
The computer will behave as a member server. However, there are still some
remaining files and registry entries on the computer that are associated with the
domain controller. If the domain controller cannot start in normal mode do the
following:
remaining files and registry entries on the computer that are associated with the
domain controller. If the domain controller cannot start in normal mode do the
following:
- disjoin domained (joined new workgroup)
- install DNS Server and point to itself
6. Start Registry Editor and locate the following registry entry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Parameters
If there is an entry for Src Root Domain Srv , right-click the value and then
click Delete. This value must be deleted so that the domain controller sees itself
as the only domain controller in the domain after promotion. Go through the
following keys to delete reference to the old domain controller:
click Delete. This value must be deleted so that the domain controller sees itself
as the only domain controller in the domain after promotion. Go through the
following keys to delete reference to the old domain controller:
HKEY_LOCAL_MACHINE\Software\Microsoft\ADS\LDAP\CN=....
HKEY_LOCAL_MACHINE\System\CCS\DNS
\Parameters|PreviousLocalHostName
\Parameters|PreviousLocalHostName
HKEY_LOCAL_MACHINE\System\TCP
\Services\TCPIP\Parameters|Domain and NV Domain
\Services\TCPIP\Parameters|Domain and NV Domain
7. Remove the remaining files and registry entries. To do this, follow these steps:
a. Start the Active Directory Installation Wizard.
b. Install Active Directory to make the computer a domain controller for a new, temporary domain, such as "psstemp.deleteme."
Note Make sure that you make the computer a domain controller in a different forest.
c. After you install Active Directory, start the Active Directory Installation Wizard again, and then remove Active Directory from the domain controller.
Perform a metadata cleanup for the demoted domain controller on a surviving domain controller in the forest. Active Directory stores a considerable amount of metadata about a domain controller. During the normal process of uninstalling Active Directory on a domain controller, this metadata is removed from Active Directory through a connection to another domain controller in the domain. A forced removal assumes that there is no connectivity to the domain; therefore, it does not attempt any metadata removal (cleanup).
Consequently, forced removal of Active Directory from a domain controller should always be followed by the metadata cleanup procedure, which removes all references to the domain controller from the domain and forest. For more details, view the following KB article: http://support.microsoft.com/kb/216498/en-us
How to remove data in Active Directory after an unsuccessful domain controller demotion
Windows Server 2003 Service Pack 1 (SP1) or later service packs – Enhanced version of Ntdsutil.exe
The version of Ntdsutil.exe that is included with Service Pack 1 or later service packs for Windows Server 2003 has been enhanced to make the metadata cleanup process complete. The Ntdsutil.exe version that is included with SP1 or later service packs does the following when metadata cleanup is run:
- Removes the NTDSA or NTDS Setting subject.
- Removes inbound AD connection objects that existing destination DCs use to replicate from the source DC being deleted .
- Removes the computer account .
- Removes FRS member object.
- Removes FRS subscriber objects.
- Tries to seize flexible single operations master roles (also known as flexible single master operations or FSMO) held by the DC that are being removed .
Caution The administrator must also make sure that replication has occurred since the demotion before manually removing the NTDS Settings object for any server. Using the Ntdsutil utility incorrectly may result in partial or complete loss of Active Directory functionality.
Procedure 1: Windows Server 2003 SP1 or later service packs only
- Click Start, point to Programs, point to Accessories, and then click Command Prompt.
- At the command prompt, type ntdsutil, and then press ENTER.
- Type metadata cleanup, and then press ENTER. Based on the options given, the administrator can perform the removal, but additional configuration parameters must be specified before the removal can occur.
- Type connections and press ENTER. This menu is used to connect to the specific server where the changes occur. If the currently logged on user does not have administrative permissions, different credentials can be supplied by specifying the credentials to use before making the connection. To do this, type set creds DomainNameUserNamePassword, and then press ENTER. For a null password, type null for the password parameter.
- Type connect to server servername, and then press ENTER. You should receive confirmation that the connection is successfully established. If an error occurs, verify that the domain controller being used in the connection is available and the credentials you supplied have administrative permissions on the server.
Note If you try to connect to the same server that you want to delete, when you try to delete the server that step 15 refers to, you may receive the following error message:Error 2094. The DSA Object cannot be deleted0x2094 - Type quit, and then press ENTER. The Metadata Cleanup menu appears.
- Type select operation target and press ENTER.
- Type list domains and press ENTER. A list of domains in the forest is displayed, each with an associated number.
- Type select domain number and press ENTER, where number is the number associated with the domain the server you are removing is a member of. The domain you select is used to determine whether the server being removed is the last domain controller of that domain.
- Type list sites and press ENTER. A list of sites, each with an associated number, appears.
- Type select site number and press ENTER, where number is the number associated with the site the server you are removing is a member of. You should receive a confirmation listing the site and domain you chose.
- Type list servers in site and press ENTER. A list of servers in the site, each with an associated number, is displayed.
- Type select server number, where number is the number associated with the server you want to remove. You receive a confirmation listing the selected server, its Domain Name System (DNS) host name, and the location of the server's computer account you want to remove.
- Type quit and press ENTER. The Metadata Cleanup menu appears.
- Type remove selected server and press ENTER. You should receive confirmation that the removal completed successfully. If you receive the following error message, the NTDS Settings object may already be removed from Active Directory as the result of another administrator removing the NTDS Settings object or replication of the successful removal of the object after running the DCPROMO utility. Error 8419 (0x20E3)
The DSA object could not be found
Note You may also see this error when you try to bind to the domain controller that will be removed. Ntdsutil has to bind to a domain controller other than the one that will be removed with metadata cleanup. - Type quit, and then press ENTER at each menu quit the Ntdsutil utility. You should receive confirmation that the connection disconnected successfully.
- Remove the cname record in the _msdcs.root domain of forest zone in DNS. Assuming that DC will be reinstalled and re-promoted, a new NTDS Settings object is created with a new GUID and a matching cname record in DNS. You do not want the DCs that exist to use the old cname record.
As best practice, you should delete the host name and other DNS records. If the lease time that remains on Dynamic Host Configuration Protocol (DHCP) address assigned to offline server is exceeded then another client can obtain the IP address of the problem DC. - In the DNS console, use the DNS MMC to delete the A record in DNS. The A record is also known as the Host record. To delete the A record, right-click the A record, and then click Delete. Also, delete the cname record in the _msdcs container. To do this, expand the _msdcs container, right-click cname, and then click Delete.
Important If this is a DNS server, remove the reference to this DC under the Name Servers tab. To do this, in the DNS console, click the domain name under Forward Lookup Zones, and then remove this server from the Name Servers tab.
Note If you have reverse lookup zones, also remove the server from these zones. - If the deleted computer is the last domain controller in a child domain, and the child domain was also deleted, use ADSIEdit to delete the trustDomain object for the child. To do this, follow these steps:
- Click Start, click Run, type adsiedit.msc, and then click OK
- Expand the Domain NC container.
- Expand DC=Your Domain, DC=COM, PRI, LOCAL, NET.
- Expand CN=System.
- Right-click the Trust Domain object, and then click Delete.
- Use Active Directory Sites and Services to remove the domain controller. To do this, follow these steps:
- Start Active Directory Sites and Services.
- Expand Sites.
- Expand the server's site. The default site is Default-First-Site-Name.
- Expand Server.
- Right-click the domain controller, and then click Delete.
- When you use DFS Replication in Windows Server 2008 and in later versions, the current version of Ntdsutil.exe does not clean up the DFS Replication object. In this case, you can use Adsiedit.msc to correct the DFS Replication objects for Active Directory Domain Services (AD DS) manually. To do this, follow these steps:
- Logon a domain controller as a domain administrator in the affected domain.
- Start Adsiedit.msc.
- Connect to the default naming context.
- Locate the following DFS Replication topology container:CN=Topology,CN=Domain System Volume,CN=DFSR-Globalsettings,CN=System,DC=Your Domain,DC=Domain Suffix
- Delete the msDFSR-Member CN object that has the old computer name.
Procedure 2: Windows 2000 (All versions) Windows Server 2003 RTM
- Click Start, point to Programs, point to Accessories, and then click Command Prompt.
- At the command prompt, type ntdsutil, and then press ENTER.
- Type metadata cleanup, and then press ENTER. Based on the options given, the administrator can perform the removal, but additional configuration parameters must be specified before the removal can occur.
- Type connections and press ENTER. This menu is used to connect to the specific server where the changes occur. If the currently logged on user does not have administrative permissions, different credentials can be supplied by specifying the credentials to use before you make the connection. To do this, type set creds DomainNameUserNamePassword, and then press ENTER. For a null password, type null for the password parameter.
- Type connect to server servername, and then press ENTER. You should receive confirmation that the connection is successfully established. If an error occurs, verify that the domain controller being used in the connection is available and the credentials you supplied have administrative permissions on the server.
Note If you try to connect to the same server that you want to delete, when you try to delete the server that step 15 refers to, you may receive the following error message:Error 2094. The DSA Object cannot be deleted0x2094 - Type quit, and then press ENTER. The Metadata Cleanup menu appears.
- Type select operation target and press ENTER.
- Type list domains and press ENTER. A list of domains in the forest is displayed, each with an associated number.
- Type select domain number and press ENTER, where number is the number associated with the domain the server you are removing is a member of. The domain you select is used to determine whether the server being removed is the last domain controller of that domain.
- Type list sites and press ENTER. A list of sites, each with an associated number, is displayed.
- Type select site number and press ENTER, where number is the number associated with the site the server you are removing is a member of. You should receive a confirmation listing the site and domain you chose.
- Type list servers in site and press ENTER. A list of servers in the site, each with an associated number, is displayed.
- Type select server number, where number is the number associated with the server you want to remove. You receive a confirmation listing the selected server, its Domain Name System (DNS) host name, and the location of the server's computer account you want to remove.
- Type quit and press ENTER. The Metadata Cleanup menu appears.
- Type remove selected server and press ENTER. You should receive confirmation that the removal completed successfully. If you receive the following error message: Error 8419 (0x20E3)
The DSA object could not be found
Note You may also see this error when you try to bind to the domain controller that will be removed. Ntdsutil has to bind to a domain controller other than the one that will be removed with metadata cleanup. - Type quit at each menu to quit the Ntdsutil utility. You should receive confirmation that the connection disconnected successfully.
- Remove the cname record in the _msdcs.root domain of forest zone in DNS. Assuming that DC will be reinstalled and re-promoted, a new NTDS Settings object is created by using a new GUID and a matching cname record in DNS. You do not want the DC's that exist to use the old cname record.
As best practice you should delete the hostname and other DNS records. If the lease time that remains on Dynamic Host Configuration Protocol (DHCP) address assigned to offline server is exceeded then another client can obtain the IP address of the problem DC.
Now that the NTDS Settings object has been deleted, you can delete the computer account, the FRS member object, the cname (or Alias) record in the _msdcs container, the A (or Host) record in DNS, the trustDomain object for a deleted child domain, and the domain controller.
Note You do not need to manually remove the FRS member object in Windows Server 2003 RTM because the Ntdsutil.exe utility has already removed the FRS member object when you run the utility. Additionaly, the metadata of the computer account cannot be removed if the computer account of the DC contains another leaf object. For example, Remote Installation Services (RIS) might be installed on the DC.
The Adsiedit utility is included with the Windows Support Tools feature in both Windows 2000 Server and Windows Server 2003. To install the Windows Support Tools, following these steps:
Note You do not need to manually remove the FRS member object in Windows Server 2003 RTM because the Ntdsutil.exe utility has already removed the FRS member object when you run the utility. Additionaly, the metadata of the computer account cannot be removed if the computer account of the DC contains another leaf object. For example, Remote Installation Services (RIS) might be installed on the DC.
The Adsiedit utility is included with the Windows Support Tools feature in both Windows 2000 Server and Windows Server 2003. To install the Windows Support Tools, following these steps:
- Windows 2000 Server: On the Windows 2000 Server CD, open the Support\Tools folder, double-click Setup.exe, and then follow the instructions that appear on the screen.
- Windows Server 2003: On the Windows Server 2003 CD, open the Support\Tools folder, double-click Suptools.msi, click Install, and then follow the steps in the Windows Support Tools Setup Wizard to complete the installation.
- Use ADSIEdit to delete the computer account. To do this, follow these steps:
- Click Start, click Run, type adsiedit.msc in the Open box, and then click OK.
- Expand the Domain NC container.
- Expand DC=Your Domain Name, DC=COM, PRI, LOCAL, NET.
- Expand OU=Domain Controllers.
- Right-click CN=domain controller name, and then click Delete.
Note The FRS subscriber object is deleted when the computer object is deleted because it is a child of the computer account. - Use ADSIEdit to delete the FRS member object. To do this, follow these steps:
- Click Start, click Run, type adsiedit.msc in the Open box, and then click OK
- Expand the Domain NC container.
- Expand DC=Your Domain, DC=COM, PRI, LOCAL, NET.
- Expand CN=System.
- Expand CN=File Replication Service.
- Expand CN=Domain System Volume (SYSVOL share).
- Right-click the domain controller you are removing, and then click Delete.
- In the DNS console, use the DNS MMC to delete the A record in DNS. The A record is also known as the Host record. To delete the A record, right-click the A record, and then click Delete. Also delete the cname (also known as the Alias) record in the _msdcs container. To do so, expand the _msdcs container, right-click the cname, and then click Delete.
Important If this was a DNS server, remove the reference to this DC under the Name Servers tab. To do this, in the DNS console, right-click the domain name under Forward Lookup Zones, click Properties, and then remove this server from the Name Servers tab.
Note If you have reverse lookup zones, also remove the server from these zones. - If the deleted computer was the last domain controller in a child domain and the child domain was also deleted, use ADSIEdit to delete the trustDomain object for the child. To do this, follow these steps:
- Click Start, click Run, type adsiedit.msc in the Open box, and then click OK
- Expand the Domain NC container.
- Expand DC=Your Domain, DC=COM, PRI, LOCAL, NET.
- Expand CN=System.
- Right-click the Trust Domain object, and then click Delete.
- Use Active Directory Sites and Services to remove the domain controller. To do this, follow these steps:
- Start Active Directory Sites and Services.
- Expand Sites.
- Expand the server's site. The default site is Default-First-Site-Name.
- Expand Server.
- Right-click the domain controller, and then click Delete.
Advanced optional syntax with the SP1 or later versions of Ntdsutil.exe
Windows Server 2003 SP1 introduced a new syntax that can be used. By using the new syntax, it is no longer required to bind to the DS and select your operation target. To use the new syntax, you must know or obtain the DN of the NTDS settings object of the server that is being demoted. To use the new syntax for metadata cleanup, follow these steps:
- Run ntdsutil.
- Switch to the metadata cleanup prompt.
- Run the following command remove selected server <DN of the server object in the config container>An example of this command is as follows.
Note The following is one line but has been wrapped.Remove selected server cn=servername,cn=servers,cn=sitename,cn=sites,cn=configuration,dc=<forest_root_domain> - Remove the cname record in the _msdcs.root domain of forest zone in DNS. Assuming that DC will be reinstalled and re-promoted, a new NTDS Settings object is created by using a new GUID and a matching cname record in DNS. You do not want the DCs that exist to use the old cname record.
As best practice, you should delete the host name and other DNS records. If the lease time that remains on Dynamic Host Configuration Protocol (DHCP) address assigned to offline server is exceeded, another client can obtain the IP address of the problem DC. - If the deleted computer was the last domain controller in a child domain, and the child domain was also deleted, use ADSIEdit to delete the trustDomain object for the child. To do this, follow these steps:
- Click Start, click Run, type adsiedit.msc, and then click OK.
- Expand the Domain NC container.
- Expand DC=Your Domain Name, DC=COM, PRI, LOCAL, NET.
- Expand CN=System.
- Right-click the Trust Domain object,, and then click Delete.
- Use Active Directory Sites and Services to remove the domain controller. To do this, follow these steps:
- Start Active Directory Sites and Services.
- Expand Sites.
- Expand the server's site. The default site is Default-First-Site-Name.
- Expand Server.
- Right-click the domain controller, and then click Delete.
No comments:
Post a Comment