realkiller Posted December 4, 2006 Share Posted December 4, 2006 is there a way to add a computer to a domain using autoit without gui Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
realkiller Posted December 5, 2006 Author Share Posted December 5, 2006 can no one help me:( Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
Danny35d Posted December 5, 2006 Share Posted December 5, 2006 You can make a command line script. Something like Join.exe DomainName AdminUserName AdminPasswordexpandcollapse popup;$iFlag JOIN_DOMAIN = 1 ;$iFlag ACCT_CREATE = 2 ;$iFlag ACCT_DELETE = 4 ;$iFlag WIN9X_UPGRADE = 16 ;$iFlag DOMAIN_JOIN_IF_JOINED = 32 ;$iFlag JOIN_UNSECURE = 64 ;$iFlag MACHINE_PASSWORD_PASSED = 128 ;$iFlag DEFERRED_SPN_SET = 256/f ;$iFlag INSTALL_INVOCATION = 262144 Func _JoinDomain($sDomain, $sAdUserName, $sAdPassword, $sComputerName = '', $sJoinDomainOU = '', $iFlag = 1) If $sComputerName = '' Or $sComputerName = -1 Then $sComputerName = @ComputerName ;If $sJoinDomainOU = '' Then $sJoinDomainOU = Chr(0) If StringInStr($sAdUserName, '\') = 0 Then $sAdUserName = $sDomain & '\' & $sAdUserName MsgBox(0, 'Cmd', $sDomain & @CRLF & $sAdUserName & @CRLF & $sAdPassword & @CRLF & $sComputerName & @CRLF & $sJoinDomainOU & @CRLF & $iFlag) $computerObj = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\" & _ $sComputerName & "\root\cimv2:Win32_ComputerSystem.Name='" & _ $sComputerName & "'") $joinDomainResultNumber = $computerObj.JoinDomainOrWorkGroup($sDomain, $sAdPassword, $sAdUserName, $sJoinDomainOU, $iFlag) Select Case $joinDomainResultNumber = 0 $joinDomainResultText = "The domain join completed successfully." Case $joinDomainResultNumber = 5 $joinDomainResultText = "The " & $sAdUserName & " account does not have permissions. Most likely this computer was originally joined to the domain with a Account operator account. The account you are using does not have permissions to overwrite the workstation object" Case $joinDomainResultNumber = 86 Or $joinDomainResultNumber = 1326 $joinDomainResultText = "The username or password you specified is incorrect. Check the username and password as they appear below. If these values are incorrect the image will have to be updated with the current values" Case $joinDomainResultNumber = 1909 $joinDomainResultText = "The " & $sAdUserName & " account is locked out. Most likely someone has tried the password incorrectly too many times. The system sometimes will lock the account out if too many simultaneous connection attempts are occuring." Case $joinDomainResultNumber = 2224 $joinDomainResultText = "The computer account already exists on the domain and could not be overwritten. A workstation object with the same name exists in another OU. You will have to have the existing workstation object deleted." Case $joinDomainResultNumber = 2453 $joinDomainResultText = "Could not find a domain controller. Please make sure all domain controllers are online and that your network access is functional." Case $joinDomainResultNumber = 2102 $joinDomainResultText = "The workstation service is not started. Please start this service and try again." Case $joinDomainResultNumber = 2691 $joinDomainResultText = "This machine is already joined to a domain. If you wish to join this system to another domain or this domain again you will first have to unjoin your existing domain." EndSelect Return $joinDomainResultNumber EndFuncThis is a UDF to join computer into a domain, only work with WinXP and Win2k3. If you have others OS like Win2k or even WinNT then I suggest to look into Netdom M$ command line and wrapped around AutoIT.Hopefully this will get you started. You can find more information about $CmdLine in AutoIt help files. AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now