Sign in to follow this  
Followers 0
pcjunki

join domain

2 posts in this topic

here is my example "simple" script to have a pc join the domain

with the domain of "starwars", then you just type in the pc name you want.

tweak to your liking,

ShellExecute("sysdm.cpl")
sleep(1000)
ControlClick ( "System Properties", "", "[CLASS:Button; INSTANCE:2]" , "left" , 1 )
sleep(1000)
ControlClick ( "Computer Name/Domain Changes", "", "[CLASS:Button; INSTANCE:3]" , "left" , 1 )
sleep(1000)
Send("{TAB}starwars{SHIFTDOWN}{TAB}{TAB}{TAB}{SHIFTUP}")

Share this post


Link to post
Share on other sites



That is a worse approach to join a computer to a domain.

Have a look to water's

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • Jefrey
      By Jefrey
      I've ported these two functions from PHP to AU3 to work with URLs.
      Made them for those who work with libraries like HTTP.au3 (not the one I coded), that needs passing the server domain, path, etc., instead of the full URL.
      Grab the lib here.
      ParseURL( $sURL )
      Parses the URL and splits it into defined parts. Returns an array:
      [0] = Full URL (same as $sURL) [1] = Protocol (i.e.: http, https, ftp, ws...) [2] = Domain [3] = Port (or null if not specified) [4] = Path (or null if not specified) [5] = Query string (everything after the ? - or null if not specified) Example:
      $aExample = ParseURL("https://google.com:8080/?name=doe") MsgBox(0, "Test", "URL: " & $aExample[0] & @CRLF & _ "Protocol: " & $aExample[1] & @CRLF & _ "Domain: " & $aExample[2] & @CRLF & _ "Port: " & $aExample[3] & @CRLF & _ "Path: " & $aExample[4] & @CRLF & _ "Query string: " & $aExample[5])  
      ParseStr( $sStr )
      Parses a query string (similar to the [5] of the previous function) and returns a multidimensional array, where:
      [0][0] = number of variables found [0][1] = ununsed [1][0] = key name of the first variable [1][1] = first variable value (already URL decoded) [n][0] = key name of the nth variable [n][1] = nth variable value (already URL decoded) Example:
      include <Array.au3> ; need only to do _ArrayDisplay, not needed by the lib _ArrayDisplay(ParseStr("foo=bar&test=lol%20123")) #cs Result is: [0][0] = 2 [0][1] = ununsed [1][0] = foo [1][1] = bar [2][0] = test [2][1] = lol 123 #ce Feel free to fork!
    • Kevin Finnegan
      By Kevin Finnegan
      Hi all,
      I'm currently writing a backup script to automate the process of storing and compressing data for any member leaving the firm I work at. Ideally I would like to pull the user's display name or full name, for instance, a WMI query selecting FullName WHERE Win32_NetworkLoginProfile Name equals "Domain\kefinnegan" would bring back "Kevin Finnegan" or whatever naming convention your company uses.
      Although this solution seems ideal as long as you log in as a user with privileged access, it won't work if the domain user you wish to backup has been purged from the Active Directory system entirely as the WMIService seems to query it in some shape or form (thousands of members in our firm, need to trim the fat every now and then). I was wondering if it's possible to query an API, service or possibly even scan registry entries stored on the leaver's machine while logged in as the local administrator (can run the script with privileged domain credentials if needs be) that could give me a domain user's full name, who logged onto this machine, without the use of Active Directory?
    • rickybobby
      By rickybobby
      I'm Trying to get all computers returned in the active domain that have been active within the last 90 days, I'm currently stuck at just getting the full list of computers in the domain. I'm using the ADfunctions UDF.   Here's my code:     #include "XXX/ADfunctions.au3" _GetADComputers() Func _GetADComputers() Local $aComputers $sOU = $strDNSDomain _ADGetObjectsInOU($aComputers,$sOU,"(objectclass=computer)",2,"name") _ArrayDisplay($aComputers) Return($aComputers) EndFunc     Any help is greatly appreciated!
    • blckpythn
      By blckpythn
      I help manage several networks, and get a lot of password reset request for students and such.
      So instead of making some of the staff admins, I found a creative way of giving them the ability to reset passwords.

      This is obviously for Active Directory domains only, and requires the AD.au3 UDF.

      They must be part of the group listed in the ini(if you use my method), and the group must have the delegate permission for setting a user's password in AD.
      Search for Delegate Control of an OU.
      Also, if you log to a server share like I did, make sure both share and NTFS permissions are opened up.

      Only tested on Server 2003, 2008, and Win 7

      I'm open to constructive criticism, especially if anyone know another way for having the input field recognize that the enter key was pressed.

      If you download the txt, change it to an .ini file, it wouldn't let me upload an ini...



      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\CompInfo\Control-Panel.ico #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #comments-start --INFO ; ; User's must have permission and be part of the group listed in the Clients.ini under Paset. ; #comments-end ----INFO ; #include #include #include #include #include #include ; #region ----------------------------------Variables and Prep ; Global $iniPath = @ScriptDir & "\Clients.ini" Global $sLogMsg ; Global $iniLog = IniRead($iniPath, @LogonDomain, "DestPath", False) If $iniLog = "False" Then ConsoleWrite("Can't read DestPath from INI!" & @CRLF) Else $iniLog = $iniLog & "\Paset.log" EndIf ; _AD_Open() If @error Then ConsoleWrite("Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended & @CRLF) MsgBox(0, "Error with AD Open", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) Exit EndIf ; Global $iniPasetGroup = IniRead($iniPath, @LogonDomain, "Paset", False) ; If $iniPasetGroup = "False" And _AD_IsMemberOf("Domain Admins", @UserName, True) <> 1 Then _FileWriteLog($iniLog, @UserName & " attempted to run the Paset utility.") MsgBox(0, "Error", "Domain not authorized or INI file read error.") _AD_Close() Exit EndIf ; Global $iniPass = IniRead($iniPath, @LogonDomain, "DePass", False) If $iniPass = "False" Or "" Then $iniPass = "Welcome.1" Global $iniLog = IniRead($iniPath, @LogonDomain, "DestPath", False) If $iniLog = "False" Then ConsoleWrite("Can't read DestPath from INI!" & @CRLF) Else $iniLog = $iniLog & "\Paset.log" EndIf ; #endregion ----------------------------------Variables and Prep ;----------------------------------------- #region ----------------------------------Building the GUI -Live ; $gcPaset = GUICreate("Password Reset Utility", 280, 480, -1, -1) GUISetIcon("C:\Users\admin\Downloads\Sugar\CompInfo\Control-Panel.ico", -1, $gcPaset) ; $glUsers = GUICtrlCreateList("", 10, 10, 260, 270) GUICtrlCreateLabel("Please enter a username to search for.", 15, 290, 250, 20, $SS_CENTER) ; $giUsername = GUICtrlCreateInput("*", 10, 330, 200, 25) ; $gbSearch = GUICtrlCreateButton("Search", 220, 330, 50, 25) ; $glError = GUICtrlCreateLabel("Passwords are reset to: " & $iniPass, 40, 370, 200, 50, $SS_CENTER) GUICtrlSetColor(-1, 0x0000FF) ; $gbClose = GUICtrlCreateButton("Close", 10, 440, 100, 25) ; $gbReset = GUICtrlCreateButton("Reset Password", 130, 430, 140, 40) GUICtrlSetFont(-1, 10, 600) ; GUISetState(@SW_SHOW, $gcPaset) ; #endregion ----------------------------------Building the GUI -Live ;----------------------------------------- #region ----------------------------------Live Code ; While 1 If _IsPressed("0D") = 1 Then List_Users() $Msg = GUIGetMsg() Switch $Msg Case $gbSearch List_Users() Case $gbReset ResetPass() Case $GUI_EVENT_CLOSE, $gbClose _Exit() EndSwitch WEnd ; #endregion ----------------------------------Live Code ;----------------------------------------- #region ----------------------------------Functions ; Func ResetPass() ;~ GUICtrlSetData($glError, "") $sTarget = GUICtrlRead($glUsers) If $sTarget = "" Then GUICtrlSetData($glError, "Please select a user first.") Return EndIf ConsoleWrite($sTarget & @CRLF) If _AD_IsObjectLocked($sTarget) = 1 Then _AD_UnlockObject($sTarget) _AD_SetPassword($sTarget, $iniPass, 1) If @error Then MsgBox(0, "Uh Oh!", "Sorry, either you do not have permission to reset that user's password or an unknown error occurred.") _FileWriteLog($iniLog, @UserName & " failed to reset " & $sTarget & "'s password.") Else GUICtrlSetData($glError, $sTarget & "'s password was reset to " & $iniPass) _FileWriteLog($iniLog, @UserName & " reset " & $sTarget & "'s password.") EndIf EndFunc ;==>ResetPass ; Func List_Users() GUICtrlSetData($glUsers, "") If GUICtrlRead($glError) <> "Passwords are reset to: " & $iniPass Then GUICtrlSetData($glError, "Passwords are reset to: " & $iniPass) Local $sUser = GUICtrlRead($giUsername) ;~ ConsoleWrite($sUser & @CRLF) ;InputBox("Test", "User account(s) to search for." & @CRLF & "Wildcards are allowed.", "*", "", 300, 150, Default, Default, Default) If $sUser <> "*" Then $sUser = "*" & $sUser & "*" ;~ If @error = 1 Then Return Local $aUser = _AD_GetObjectsInOU("", "(&(objectcategory=person)(Samaccountname=" & $sUser & "))", 2, "samaccountname, description") If @error = 3 Then GUICtrlSetData($glError, "No Users Found!") ;~ MsgBox(16, "Test", "No user accounts found using the specified search pattern!") Else ;~ _ArrayDisplay($aUser, "List of user accounts", -1, 0, "", "|", "|SamAccountName|Description") For $i = 1 To $aUser[0][0] GUICtrlSetData($glUsers, $aUser[$i][0]) Next EndIf Return 1 EndFunc ;==>List_Users ; Func _Exit() GUIDelete($gcPaset) _AD_Close() Exit EndFunc ;==>_Exit ; #endregion ----------------------------------Functions paset.au3
      Clients.txt