tonyflora63
MIS
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!
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!