2.9. Joining a Server to a Domain
Problem
You want to join a server to an Active Directory domain so that users in the domain can access resources on the server.
Solution
Using a graphical user interface
Log onto the computer you want to join and open Control Panel → System applet.
Click the Computer Name tab.
Click the Change button.
Under Member of, select Domain.
Enter the domain you want to join and click OK.
You may be prompted to enter credentials that have permission to join the computer.
Reboot the computer.
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
Tip
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. ' ------ 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 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.