Automated domain change

Teen-Pound

Weaksauce
Joined
May 18, 2006
Messages
95
Is there anyway to automate the process of changing the domain on client PC's? I have 35 clients and manually changing the domain would be a very titius process. I'm trying to figure out a way to add a line in 'boot.ini' and to distribute that to all client pcs from the server.

Thanks
 
Here is am example of a vbs script you could use to do it.

Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Const ACCT_DELETE = 4

Dim objComputer, strComputer, strDomain, strUser, strPassword, ReturnValue

Set objNetwork = WScript.CreateObject("WScript.Network")

strComputer = objNetwork.ComputerName
strDomain = "VMNETWORK"
strUser = "Administrator"
strPassword = "Password1"

Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'")

ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, strPassword, strDomain & "\" & strUser, "ou=workstations,DC=vmnetwork,dc=local", JOIN_DOMAIN + ACCT_CREATE)

If ReturnValue = 0 Then
MsgBox "Computer added to domain without error. Workstation should now be restarted"
Else
MsgBox "Computer not added to domain successfully. Return value: " & ReturnValue
End If
 
Back
Top