• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 506
  • Last Modified:

Windows - Remotly adding computers to an existing domain

Hey everyone,

My company has a domain but only about 600 of the 6000 computers are on the domain.  

All of the computers are on the same PIP Circuits and are accessiable for the most part and have IP's on our 10.X.X.X network.

The network is mostly XP and is a 2003 mixed mode domain.

Is their a script of some sort to add their computers that are not on the domain to the existing domain, and possibly move the existing profiles to the new domain account without physically accessing the computers?

Thanks a lot,
inverted
0
inverted_2000
Asked:
inverted_2000
  • 5
  • 3
1 Solution
 
dooleydogCommented:
Here is a link with info on how to allow users to do this through GP, which would greatly simplify your life for the immediate future. All users have to do is log on, and the computer account is created automatically.

http://technet2.microsoft.com/windowsserver/en/library/7207aa3e-d95d-4176-a1ca-bc629f1ca6981033.mspx?mfr=true

Good Luck,
0
 
inverted_2000Author Commented:
Well for the most part...I have the ability through Everdream to push scripts to computers that are not on the domain but are on the network.  Dooleydog...that technet article doesn't really explain the means by which to accomplish this task:

"Description
This security setting determines which groups or users can add workstations to a domain."

I'm going to look more towards merowingers' script.  

Anyone else?



0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
merowingerCommented:
here's a complete "join computer to domain" script
Note u can make the Computername varaible with a inputbox! Or read it out from a textfile!


'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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"

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

set objWMILocator = CreateObject("WbemScripting.SWbemLocator")
objWMILocator.Security_.AuthenticationLevel = 6
set objWMIComputer = objWMILocator.ConnectServer(strComputer,  _
                                              "root\cimv2", _
                                                 strLocalUser, _
                                                 strLocalPasswd)
set objWMIComputerSystem = objWMIComputer.Get( _
                               "Win32_ComputerSystem.Name='" & _
                               strComputer & "'")

rc = objWMIComputerSystem.JoinDomainOrWorkGroup(strDomain, _
                                                strDomainPasswd, _
                                                strDomainUser, _
                                                vbNullString, _
                                                JOIN_DOMAIN)
if rc <> 0 then
    WScript.Echo "Join failed with error: " & rc
else
    WScript.Echo "Successfully joined " & strComputer & " to " & strDomain
end if
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0
 
inverted_2000Author Commented:
"Note u can make the Computername varaible with a inputbox! Or read it out from a textfile!"

How is that scripted...that might be really helpful instead of using an individual script for each node, a variable filled from a text file might rock really really.

Thanks a lot,
0
 
merowingerCommented:
With InputBox:

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
strComputer     = InputBox("Please Enter Computer Name to Join")
strDomain       = "DomainName"        ' e.g. rallencorp.com
strDomainUser   = "DomainUserUPN"     ' e.g. administrator@rallencorp.com
strDomainPasswd = "DomainUserPasswd"
strLocalUser    = "ComputerAdminUser" ' e.g. administrator
strLocalPasswd  = "ComputerUserPasswd"

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

set objWMILocator = CreateObject("WbemScripting.SWbemLocator")
objWMILocator.Security_.AuthenticationLevel = 6
set objWMIComputer = objWMILocator.ConnectServer(strComputer,  _
                                              "root\cimv2", _
                                                 strLocalUser, _
                                                 strLocalPasswd)
set objWMIComputerSystem = objWMIComputer.Get( _
                               "Win32_ComputerSystem.Name='" & _
                               strComputer & "'")

rc = objWMIComputerSystem.JoinDomainOrWorkGroup(strDomain, _
                                                strDomainPasswd, _
                                                strDomainUser, _
                                                vbNullString, _
                                                JOIN_DOMAIN)
if rc <> 0 then
    WScript.Echo "Join failed with error: " & rc
else
    WScript.Echo "Successfully joined " & strComputer & " to " & strDomain
end if
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0
 
merowingerCommented:
With Textfile:

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dim objFSO, objFile
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.OpenTextFile("C:\YourPCs.txt")

strDomain       = "DomainName"        ' e.g. rallencorp.com
strDomainUser   = "DomainUserUPN"     ' e.g. administrator@rallencorp.com
strDomainPasswd = "DomainUserPasswd"
strLocalUser    = "ComputerAdminUser" ' e.g. administrator
strLocalPasswd  = "ComputerUserPasswd"

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


do while not objFile.AtEndOfStream
strComputer = objFile.ReadLine

set objWMILocator = CreateObject("WbemScripting.SWbemLocator")
objWMILocator.Security_.AuthenticationLevel = 6
set objWMIComputer = objWMILocator.ConnectServer(strComputer,  _
                                              "root\cimv2", _
                                                 strLocalUser, _
                                                 strLocalPasswd)
set objWMIComputerSystem = objWMIComputer.Get( _
                               "Win32_ComputerSystem.Name='" & _
                               strComputer & "'")

rc = objWMIComputerSystem.JoinDomainOrWorkGroup(strDomain, _
                                                strDomainPasswd, _
                                                strDomainUser, _
                                                vbNullString, _
                                                JOIN_DOMAIN)
if rc <> 0 then
    WScript.Echo "Join failed with error: " & rc
else
    WScript.Echo "Successfully joined " & strComputer & " to " & strDomain
end if
Loop
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0
 
inverted_2000Author Commented:
That rocks...thanks a lot peeps (o:
0
 
merowingerCommented:
your welcome :) thanks for the points!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now