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
Log on to the computer you want to join and open the Control Panel.
Open the 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 of a user that has permission to join the computer.
Reboot the computer.
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.