Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Joining a remote computer to a domain

Status
Not open for further replies.
May 22, 2003
42
US
Hi

The following script runs fine locally, but can someone help me to modify it so it can run on a machine remotely?

Const JOIN_DOMAIN = 1
Const JOIN_UNSECURE = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144

strDomain = "DS"
Wscript.StdOut.Write "Please enter your DS AD user name:"
strUser = Wscript.StdIn.ReadLine
Set objPassword = CreateObject("ScriptPW.Password")
Wscript.StdOut.Write "Please enter your password:"
strPassword = objPassword.GetPassword()

Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName
'strComputer = InputBox("Please enter the name of the computer that you wish to join to the DS Domain")
Set objComputer = _
GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" _
& strComputer & "'")
ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, _
strDomain & "\" & strUser, _
NULL, _
JOIN_DOMAIN)

Thanks in advance!
 
Thanks, I've thought about it but I was just wondering if there is a way to execute it remotely within the vbscript. besides i'd like to just accomplish this with VBScript, and not have to worry about any licensing issues for PStools.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top