Jump to content

Help Please


Recommended Posts

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.

Link to comment
Share on other sites

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 by Iceman682
Link to comment
Share on other sites

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 by Iceman682
Link to comment
Share on other sites

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

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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 by Iceman682
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...