Question

Locked

domain join

By kofi06 ·
i need to move several computer accounts from a workgroup and join them to a w2k domain. could someone send me a script for the task?

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Two possible solutions.

by aiglesias In reply to domain join

You can take a look at this link: http://msdn2.microsoft.com/en-us/library/aa392154.aspx, or you can take a shot with the script below; just be aware that the pasted script only works for XP and 2003 computers (in your case, I would rather give it a try with the link):

-- Script beginning --

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_NAME_HERE"
strPassword = "USER_PASS_HERE"
strUser = "USER_ID_HERE"

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)

-- Script ending --

Hope at least one of these solutions will help you.
Best regards,

Back to Desktop Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums