16.18. Joining a Computer to a Domain

Problem

You want to join a computer to a domain after the computer account has already been created in Active Directory.

Solution

Using a graphical user interface

  1. Log on to the computer you want to join and open the Control Panel.

  2. Open the System applet.

  3. Click the Computer Name tab.

  4. Click the Change button.

  5. Under Member of, select Domain.

  6. Enter the domain you want to join and click OK.

  7. You may be prompted to enter credentials of a user that has permission to join the computer.

  8. Reboot the computer.

  9. Note that the tab names in the System applet vary between Windows 2000, Windows XP, and Windows Server 2003.

Using a command-line interface

Run the following command to join a computer to a domain:

> netdom join <ComputerName> /Domain <DomainName> /UserD <DomainUserUPN> /PasswordD * 
/UserO <ComputerAdminUser> /PasswordO * /Reboot

Using VBScript

' This code joins a computer to a domain.
' The JoinDomainOrWorkGroup( ) method was introducted in Windows XP
' so this code works only against Windows XP and Windows Server 2003.
' ------ SCRIPT CONFIGURATION ------
strComputer     = "<ComputerName>"      ' e.g., joe-xp
strDomain       = "<DomainName>"        ' e.g., rallencorp.com
strDomainUser   = "<DomainUserUPN>"     ' e.g., administrator@rallencorp.com
strDomainPasswd = "<DomainUserPasswd>"
strLocalUser    = "<ComputerAdminUser>" ' e.g., administrator
strLocalPasswd  = "<ComputerUserPasswd>" ' ------ END CONFIGURATION --------- '######################## ' Constants '######################## Const ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.