Bert Posted October 24, 2012 Share Posted October 24, 2012 I haven't looked at the script but could you on exit do some type of logging to see what is hanging? Could it be a connection that is having a hard time closing? Not an expert in this area and I may be completely off base so forgive me if I speak out of turn. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Iceman682 Posted October 24, 2012 Author Share Posted October 24, 2012 Thanks, I'll give it a try this evening Link to comment Share on other sites More sharing options...
Iceman682 Posted October 24, 2012 Author Share Posted October 24, 2012 (edited) Case $BOK Local $sObject = GUICtrlRead($IObject) Local $ssComputer = GUICtrlRead($ComputerToMove) Local $hSelection = _GUICtrlTreeView_GetSelection($hTree) If $hSelection = 0 Then MsgBox(64, "Error", "You must select an OU!") Endif For $i = 1 To $aTreeView[0][0] If $hSelection = $aTreeView[$i][2] Then ExitLoop Next Local $sOU = $aTreeView[$i][1] ExitLoop EndSwitch WEnd I think I'm missing something as I get the msgbox when no OU is selected and the move and update button is pressed but then it exits so its not looping back. What am I missing? Edited October 24, 2012 by Iceman682 Link to comment Share on other sites More sharing options...
Iceman682 Posted October 24, 2012 Author Share Posted October 24, 2012 (edited) Case $BOK Local $sObject = GUICtrlRead($IObject) Local $ssComputer = GUICtrlRead($ComputerToMove) Local $hSelection = _GUICtrlTreeView_GetSelection($hTree) If $hSelection = 0 Then MsgBox(64, "Error", "You must select an OU!") Else For $i = 1 To $aTreeView[0][0] If $hSelection = $aTreeView[$i][2] Then ExitLoop Next Local $sOU = $aTreeView[$i][1] ExitLoop EndIf EndSwitch WEnd It seems I got it working, I hope it's the best way! Edited October 24, 2012 by Iceman682 Link to comment Share on other sites More sharing options...
Bowmore Posted October 24, 2012 Share Posted October 24, 2012 You could also have used continueloop If $hSelection = 0 Then MsgBox(64, "Error", "You must select an OU!") Continueloop Endif "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
water Posted October 24, 2012 Share Posted October 24, 2012 Looks good. I think this is the way it's being done in my example script too. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Iceman682 Posted October 26, 2012 Author Share Posted October 26, 2012 (edited) Func _AddAdmins($InputUserAdmin) GUISetState(@SW_HIDE, $localAdminsGUI) RunWait(@ComSpec & " /c " & "Net localgroup Administrators " & $HelpDesk & " /add", "", @SW_HIDE) RunWait(@ComSpec & " /c " & "Net localgroup Administrators " & $InputUserAdmin & " /add", "", @SW_HIDE) MsgBox(0, "", "Authorised accounts successfully added to the Administrators Group") GUISetState(@SW_SHOW, $localAdminsGUI) EndFunc ;==>_AddAdmins Func _AddPowerUsers($InputPowerUser) GUISetState(@SW_HIDE, $localAdminsGUI) RunWait(@ComSpec & " /c " & "Net localgroup Administrators " & $HelpDesk & " /add", "", @SW_HIDE) RunWait(@ComSpec & " /c " & '"Net localgroup "Power Users" "' & $InputPowerUser & " /add", "", @SW_HIDE) MsgBox(0, "", "Authorised accounts successfully added to the Administrators and Power User Group") GUISetState(@SW_SHOW, $localAdminsGUI) EndFunc ;==>_AddPowerUsers I seem to have found another issue that hopefully someone could assist. As #RequiresAdmin is inserted, my script pops up the UAC prompts after the domain join and subsequent reboot asking for elevated credentials, unfortunatly when these are inserted it fails. After removing the #RequiresAdmin the UAC prompts are gone, however when a domain user is added to the local Administrators Group or the Power Users Group the user names are not inserted into the respective groups. (due to it requiring the #RequiresAdmin) Any assistance will be most welcome. Edited October 26, 2012 by Iceman682 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