Recipe 3.4 Automating the Promotion or Demotion of a Domain Controller

3.4.1 Problem

You want to automate the installation or removal of a domain controller. You can make the promotion process part of your standard build process by incorporating the necessary configuration lines in your answer file(s).

3.4.2 Solution

You can automate the promotion of a domain controller by using the unattended process when building the server or by manually running dcpromo after the system has been built. Pass an answer file containing the necessary lines to promote the server to dcpromo by specifying a /answer switch. Here is an example:

> dcpromo /answer:<path_to_answer_file>

If you want to run dcpromo as part of an unattended setup, you need to add a [GUIRunOnce] section in your unattended setup file that calls the dcpromo process. You can promote a domain controller only after setup has completed and someone logs in for the first time. That is why it is necessary to use a [GUIRunOnce] section, which sets the RunOnce registry key to kick off dcpromo after someone logs in. Here is an example:

"dcpromo /answer:%systemroot%\system32\$winnt$.inf"

The dcpromo answer section starts with [DCInstall]. Here is an example answer file for adding a domain controller to an existing domain in the forest:


3.4.3 Discussion

For a complete list of Windows Server 2003 [DCInstall] settings, see the ref.chm help file in \support\tools\ that can be found on the Windows Server 2003 CD. For Windows 2000, the settings can be found in the unattend.doc file in \support\tools\ on the Windows 2000 CD.

3.4.4 See Also

MS KB 223757 (Unattended Promotion and Demotion of Windows 2000 Domain Controllers), and MS KB 224390 (How to Automate Windows 2000 Setup and Domain Controller Setup)

    Chapter 3. Domain Controllers, Global Catalogs, and FSMOs
    Chapter 6. Users
    Appendix A. Tool List