Jump to content

Search the Community

Showing results for tags 'active directory;'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I want to modify the user account "User Cannot Change Password" option by remotely connecting to the Active Directory (using the same way as RSAT). Current situation: I run the following script on the local computer to connect to the Active Directory and modify the "User Cannot Change Password" option of the specified user account, the setting does not take effect. #NoTrayIcon ;~ #RequireAdmin #include <AD.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> _AD_ErrorNotify(1) Global $AD_user = "gg.com\ADadmin" ;ADadmin member of Domain Admins Global $AD_pswd = "Abcd.123654" Global $AD_domain = "gg.com" Global $nMsg, $sUser, $sUser1, $sUser2 _AD_Open($AD_user,$AD_pswd,"",$AD_domain) If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) Global $iReply = MsgBox(308, "Enables/Disable change password", "This script Enables/Disable the specified user to change their password." & @CRLF & @CRLF & _ "Are you sure you want to change the Active Directory?") If $iReply <> 6 Then Exit #region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Active Directory Functions - Example 1", 714, 124) GUICtrlCreateLabel("User to change (FQDN or sAMAccountName):", 8, 10, 231, 17) Global $IUser = GUICtrlCreateInput("", 241, 10, 459, 21) Global $BDisable = GUICtrlCreateButton( "Disable", 8, 72, 121, 33) Global $BEnable = GUICtrlCreateButton( "Enable", 260, 72, 121, 33) Global $BCancel = GUICtrlCreateButton("Cancel", 628, 72, 73, 33, BitOR($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON)) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $BCancel Exit Case $BDisable $sUser1 = GUICtrlRead($IUser) _DisablePasswordChange($sUser1) ExitLoop Case $BEnable $sUser2 = GUICtrlRead($IUser) _EnablePasswordChange($sUser2) ExitLoop EndSwitch WEnd Func _DisablePasswordChange($sUser) Local $iValue1 = _AD_DisablePasswordChange($sUser) ConsoleWrite("Result: " & $iValue1 & ", error: " & @error & ", extended: " & @extended) If $iValue1 = 1 Then MsgBox(64, "Disable Password Change", "User '" & $sUser & "' successfully changed") ElseIf @error = 1 Then MsgBox(64, "Disable Password Change", "User '" & $sUser & "' does not exist") Else MsgBox(64, "Disable Password Change", "Return code '" & @error & "' from Active Directory") EndIf EndFunc Func _EnablePasswordChange($sUser) Local $iValue2 = _AD_EnablePasswordChange($sUser) ConsoleWrite("Result: " & $iValue2 & ", error: " & @error & ", extended: " & @extended) If $iValue2 = 1 Then MsgBox(64, "Enable Password Change", "User '" & $sUser & "' successfully changed") ElseIf @error = 1 Then MsgBox(64, "Enable Password Change", "User '" & $sUser & "' does not exist") Else MsgBox(64, "Enable Password Change", "Return code '" & @error & "' from Active Directory") EndIf EndFunc _AD_Close() I get the _AD_ErrorNotify(1) error message: COM Error Encountered in _AD_DisablePasswordChange.au3 AD UDF version = 1.6.1 @AutoItVersion = 3.3.15.4 @AutoItX64 = 1 @Compiled = 0 @OSArch = X64 @OSVersion = WIN_10 Scriptline = 1322 NumberHex = 0x80020009 Number = -2147352567 WinDescription = Exception occurred. Description = Source = HelpFile = HelpContext = 0 LastDllError = 0 The script can modify the user's "User Cannot Change Password" option and take effect when running in Active Directory. I've been working on this for a few days and can't figure it out. Does anyone have the same problem and I need help.😭 thanks in advance!
×
×
  • Create New...