Adding a Computer to the Domain
A few weeks back I needed to figure out how to add some computers to our domain. I did not want to go to every computer. There are a couple of ways to add a computer to the domain. The first is a VBS script. I am not sure where I found this script, but here it is:
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 = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144
strDomain = "DOMAIN"
strPassword = "PASSWORD"
strUser = "USERNAME"
Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName
Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _
strComputer & "'")
ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, _
strDomain & "\" & strUser, _
NULL, _
JOIN_DOMAIN + ACCT_CREATE)
This script is really nice. It runs without a command prompt opening. It also does not require any additional files to work.
There is another script that does the same thing, it is a little more simple. First you need to get netdom.exe from the Windows XP Service Pack 2 Support Tools. Once you have downloaded the Support Tools and placed netdom.exe in the C:\Windows\System32 folder you can run this script:
netdom.exe join %computername% /domain:"DOMAIN" /userd:"USERNAME" /passwordd:"PASSWORD"
We created a special account that can add computers to the domain. If you use this script a lot you may want to make sure that the password does not expire on the account. Both of these methods can be run through Altiris solutions. Good luck.
- Login or register to post comments
- 2190 reads
- Printer-friendly version
















Recent comments
14 min 19 sec ago
23 min 36 sec ago
39 min 11 sec ago
53 min 49 sec ago
1 hour 33 min ago
3 hours 6 min ago
3 hours 8 min ago
3 hours 9 min ago
3 hours 21 min ago
4 hours 18 min ago