2.9. Joining a Server to a Domain


You want to join a server to an Active Directory domain so that users in the domain can access resources on the server.


Using a graphical user interface

  1. Log onto the computer you want to join and open Control Panel System applet.

  2. Click the Computer Name tab.

  3. Click the Change button.

  4. Under Member of, select Domain.

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

  6. You may be prompted to enter credentials that have permission to join the computer.

  7. Reboot the computer.

  8. Note that the tabs in the System applet vary between Windows 2000, Windows XP, and Windows Server 2003.

Using a command-line interface

The following command joins a computer to a domain:

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


The last character in the /UserO and /PasswordO options is the letter O, not the number 0.

Using VBScript

' This code joins a server to a domain.
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 JOIN_DOMAIN = 1 Const ACCT_CREATE = 2 Const ACCT_DELETE = 4 Const WIN9X_UPGRADE = 16 Const DOMAIN_JOIN_IF_JOINED = 32 Const JOIN_UNSECURE ...

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.