njdev1k Posted August 20, 2004 Share Posted August 20, 2004 (edited) Is there a way to run Netdom to join a machine to a domain through autoit? I have tried the below script and also rewritten the command for netdom a few times. Dim $username, $passwd $bLoop = 1 While $bLoop = 1 $username = InputBox("Username", "Please enter your username and click OK", "Ex. johndo", "") If @error = 1 Then MsgBox(4096, "Error", "You pressed 'Cancel' - try again!") Else If $username = "" Then MsgBox(4096, "Error", "You must enter your username") Else $bLoop = 0 EndIf EndIf WEnd $bLoop = 1 While $bLoop = 1 $passwd = InputBox("Password", "Please enter your password and click OK", "", "*") If @error = 1 Then MsgBox(4096, "Error", "You pressed 'Cancel' - try again!") Else If $passwd = "" Then MsgBox(4096, "Error", "You must enter your password") Else $bLoop = 0 EndIf EndIf WEnd $bLoop = 1 While $bLoop = 1 $computeramt = InputBox("Computer", "Please enter what number computer this is Ex. If this is your Only computer leave 01 and hit OK", "01", "") If @error = 1 Then MsgBox(4096, "Error", "You pressed 'Cancel' - try again!") Else If $computeramt = "" Then MsgBox(4096, "Error", "You must enter a number") Else $bLoop = 0 EndIf EndIf WEnd RunWait("C:\Netdom.exe JOIN COMPUTERNAME /DOMAIN:domainname /UserD:$username /PasswordD:$passwd","",@SW_HIDE) Edited August 20, 2004 by njdev1k Link to comment Share on other sites More sharing options...
Developers Jos Posted August 20, 2004 Developers Share Posted August 20, 2004 Is there a way to run Netdom to join a machine to a domain through autoit? I have tried the below script and also rewritten the command for netdom a few times. <{POST_SNAPBACK}>Try: RunWait(@comspec & " /c c:\Netdom.exe JOIN COMPUTERNAME /DOMAIN:domainname /UserD:" & $username & " /PasswordD:" & $passwd ,"",@SW_HIDE) Are you sure about the location of Netdom.exe ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
njdev1k Posted August 20, 2004 Author Share Posted August 20, 2004 Try: RunWait(@comspec & " /c c:\Netdom.exe JOIN COMPUTERNAME /DOMAIN:domainname /UserD:" & $username & " /PasswordD:" & $passwd ,"",@SW_HIDE) Are you sure about the location of Netdom.exe ? <{POST_SNAPBACK}>Yes I'm sure Netdom is in that location, the command you provided did not work. Thanks for trying. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 20, 2004 Developers Share Posted August 20, 2004 (edited) Try running it with the /K in stead of /c and remove the @SW_HIDE just to see what the reason for failure is... RunWait(@comspec & " /k c:\Netdom.exe JOIN COMPUTERNAME /DOMAIN:domainname /UserD:" & $username & " /PasswordD:" & $passwd ) Edited August 20, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
njdev1k Posted August 20, 2004 Author Share Posted August 20, 2004 OK problem solved. I moved the netdom.exe to C:\Windows\System32 and then ran RunWait(@comspec & " /k Netdom.exe JOIN COMPUTERNAME /DOMAIN:domainname /UserD:" & $username & " /PasswordD:" & $passwd ) I took out the C:\ before netdom.exe Thank you for your help, you rock JdeB!!!! 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