water Posted October 11, 2013 Author Posted October 11, 2013 Correct. I remember there was a similar problem months ago. You need to modify the function to work correctly with spaces. I will have a look at post what I find. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
water Posted October 11, 2013 Author Posted October 11, 2013 The problem (and a quite complex solution) is described >here. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
gcue Posted November 5, 2013 Posted November 5, 2013 any idea how this is possible? users can change their AD passwords as their passwords expire every month i tried using this writing a script where a user runs either of these... _AD_SetPassword($samaccount, $password) _AD_SetPassword($fqdn, $password) but they can't change their password. how are they able to change the password to the same user object via windows? if you know of a way please let me know! thanks =)
water Posted November 5, 2013 Author Posted November 5, 2013 Do you get any error message by the COM error handler? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
gcue Posted November 5, 2013 Posted November 5, 2013 didnt have one implemented.. off to a meeting but will test when i get back thanks
water Posted November 5, 2013 Author Posted November 5, 2013 Will have to investigate ... Stay tuned My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
water Posted November 6, 2013 Author Posted November 6, 2013 The user doesn't have permission to change his password this way. I haven't found a working solution on the web when searching for "change windows login password visual basic". My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
gcue Posted November 6, 2013 Posted November 6, 2013 going to try this.. http://forums.devx.com/showthread.php?169107-Change-Active-Directory-Pssword-Using-VB-6
water Posted November 6, 2013 Author Posted November 6, 2013 Would like to hear if it works. Maybe we can add a ChangePassword function to the UDF? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
water Posted November 6, 2013 Author Posted November 6, 2013 Here is some docu on MSDN about the ChangePassword method. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
gcue Posted November 6, 2013 Posted November 6, 2013 (edited) unclear on syntax to change AD password. supposed to be ObjGet("WinNT:/" & @LogonDomain & "/" & @UserName) not ObjGet("LDAP:/" & $fqdn) right? Edited November 6, 2013 by gcue
water Posted November 6, 2013 Author Posted November 6, 2013 (edited) This works fine with the latest beta of AutoIT: #include <Debug.au3> _DebugSetup() _DebugCOMError() Global $oUsr = ObjGet("WinNT:\\" & @LogonDomain & "/" & @UserName & ",user") $oUsr.ChangePassword("oldpw", "newpw") Replace with double slashes as the forum software seems to have problems with double slashes. Edited November 6, 2013 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
gcue Posted November 6, 2013 Posted November 6, 2013 hmm not working for me.. no com error either. tried on a user and on my account (have access to ad objects)
water Posted November 6, 2013 Author Posted November 6, 2013 Which version of AutoIt do you use? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
gcue Posted November 6, 2013 Posted November 6, 2013 actually i am getting an error.. saw it in console We intercepted a COM Error ! Number is: 80020009 Linenbr is: 728 Description is: The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements. Windescription is: The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements. strange thing is the password i am choosing is within our policy requirements. wonder if its using a different policy changing. let me play with this some more.
gcue Posted November 6, 2013 Posted November 6, 2013 any chance you going to include it in your udf? =)
gcue Posted November 6, 2013 Posted November 6, 2013 got it working! looks like we have a minimum password age http://msdn.microsoft.com/en-us/library/ms813415.aspx that's why it was failing =)
water Posted November 6, 2013 Author Posted November 6, 2013 Something like this (replace "/-/" with "//"): ; #FUNCTION# ==================================================================================================================== ; Name...........: _AD_ChangePassword ; Description ...: Changes the password for the currently logged on user. ; Syntax.........: _AD_ChangePassword($sOldPW, $sNewPW) ; Parameters ....: $sOldPW - Old password of the user ; $sNewPW - New password to be set for the user ; Return values .: Success - 1 ; Failure - 0, sets @error to: ; |1 - Error accessing the current user object ; |2 - Error returned by ChangePassword method (Missing permission etc.) ; Author ........: water ; Modified.......: ; Remarks .......: This allows a logged on user without elevated permissions to change his password. ; Related .......: _AD_IsPasswordExpired, _AD_GetPasswordExpired, _AD_GetPasswordDontExpire, _AD_DisablePasswordExpire, _AD_EnablePasswordExpire, _AD_EnablePasswordChange, _AD_DisablePasswordChange, _AD_GetPasswordInfo, _AD_SetPassword ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _AD_ChangePassword($sOldPW, $sNewPW) Local $oUsr = ObjGet("WinNT:/-/" & @LogonDomain & "/" & @UserName & ",user") If @error <> 0 Then Return SetError(1, @error, 0) $oUsr.ChangePassword($sOldPW, $sNewPW) If @error <> 0 Then Return SetError(2, @error, 0) Return 1 EndFunc ;==>_AD_ChangePassword My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
gcue Posted November 7, 2013 Posted November 7, 2013 thank you so much for all your help water and for all your efforts towards the amazing udf!
Recommended Posts