water Posted September 19, 2014 Author Posted September 19, 2014 (edited) No the accountExpires doesn't give me the date and time when it expires. I created a new function with the _AD_IsAccountExpired (@username) and changed the line 3958 from the AD.au3 to If $sAccountExpires <> "19700101000000" And StringLeft ($sAccountExpires, 8) <> "16010101" Then Return $sAccountExpires Then I only had to format the string that it returned _AD_GetObjectProperties should return the expiration date. What do you get with _AD_GetObjectProperties? Edited September 19, 2014 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
jcpetu Posted September 20, 2014 Posted September 20, 2014 _AD_GetObjectsInOU doesn't translate the properties into a readable format. That's what _AD_GetObjectProperties is for. Unfortunately you need to retrieve the properties for every object. A combined function can be found here. Thanks a lot Water. Quite interesting function. I´ll tested.
colombeen Posted September 22, 2014 Posted September 22, 2014 (edited) I have a weird problem... when I run this query : $AD_query = _AD_GetObjectsInOU("", "(&(objectcategory=person)(objectclass=user)(ANR=" & GUICtrlRead ($SearchInput) & "))", 2, _ "extensionattribute6,displayname,telephoneNumber,mail,description,company,department,title,physicalDeliveryOfficeName," & _ "sAMAccountName,extensionattribute10,extensionattribute2,homeDirectory,ScriptPath," & _ "pwdlastset", "displayname") I get this error when requesting the _AD_GetPasswordInfo (not always but in some minor cases) : "C:\Program Files\AutoIt3\Include\AD.au3" (3091) : ==> Variable must be of type "Object".: If $sPwdLastChanged.LowPart = 0 And $sPwdLastChanged.HighPart = 0 Then If $sPwdLastChanged^ ERROR Anyone who knows why this happens? My query asks for user objects so I don't get it. Edited September 22, 2014 by colombeen
water Posted September 22, 2014 Author Posted September 22, 2014 What is the value of @error after you called _AD_GetObjectsInOU? 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
colombeen Posted September 22, 2014 Posted September 22, 2014 This is a bit more : If GUICtrlRead ($SearchInput) <> "" Then If _AD_ObjectExists (GUICtrlRead ($SearchInput)) Then $AD_query = _AD_GetObjectsInOU("", "(&(objectcategory=person)(objectclass=user)(sAMAccountName=" & GUICtrlRead ($SearchInput) & "))", 2, _ "extensionattribute6,displayname,telephoneNumber,mail,description,company,department,title,physicalDeliveryOfficeName," & _ "sAMAccountName,extensionattribute10,extensionattribute2,homeDirectory,ScriptPath," & _ "pwdlastset", "displayname") Else $AD_query = _AD_GetObjectsInOU("", "(&(objectcategory=person)(objectclass=user)(ANR=" & GUICtrlRead ($SearchInput) & "))", 2, _ "extensionattribute6,displayname,telephoneNumber,mail,description,company,department,title,physicalDeliveryOfficeName," & _ "sAMAccountName,extensionattribute10,extensionattribute2,homeDirectory,ScriptPath," & _ "pwdlastset", "displayname") EndIf If @error > 0 Then Return False ; here a check if there is more then 1 result etc If _AD_ObjectExists ($AD_query[1][9]) = 0 Then Return MsgBox (16, "Digipolis Active Directory tool - Error", "Er heeft zich een fout voorgedaan tijdens" & @CRLF & "het ophalen van de gegevens van " & $AD_query[1][9]) $PassInfo = _AD_GetPasswordInfo ($AD_query[1][9]) ; here is where it fails If Not $AD_query[1][0] = "" Then ...
water Posted September 22, 2014 Author Posted September 22, 2014 Again: What is the value of @error after you called _AD_GetObjectsInOU? 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
colombeen Posted September 22, 2014 Posted September 22, 2014 No error. that was what i was trying to show you with my code... there are 4 checks if the user is an object but still everything works until the password part.
water Posted September 22, 2014 Author Posted September 22, 2014 Could you please insert ConsoleWrite(">" & $AD_query[1][9] & "<" & @CRLF) before calling _AD_GetPasswordInfo? What do you get on the SciTE console? 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
colombeen Posted September 23, 2014 Posted September 23, 2014 It returns : > nbwebsvc < (which is a normal account when i check AD)
water Posted September 23, 2014 Author Posted September 23, 2014 is there a space before and after "nbwebsvc" or did you insert it for readability? 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 September 23, 2014 Author Posted September 23, 2014 Could you please insert _AD_ErrorNotify(2) at the top of your script so we get better error information? 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
colombeen Posted September 23, 2014 Posted September 23, 2014 I took a bunch of screenshots but I stopped after like 6 errors. got like 10 or something (all looking the same) This was the endresult :
water Posted September 24, 2014 Author Posted September 24, 2014 Is this by any change a user which never changed the password? 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
colombeen Posted September 24, 2014 Posted September 24, 2014 that is a possibility. would that be the reason? and how can i fix it?
water Posted September 24, 2014 Author Posted September 24, 2014 As soon as we know that this is the root of our problem it is easy to fix by checking for an error or for the returned object. 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
colombeen Posted September 25, 2014 Posted September 25, 2014 I've sent a PM to water with an output of one of the accounts that causes the script to fail. I can't put that info publicly on a forum.
water Posted September 25, 2014 Author Posted September 25, 2014 Will check. 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 September 25, 2014 Author Posted September 25, 2014 The password has been set before for this user. So I see no problem. Can I have some more information: AutoIt version you run? Version of the AD UDF you run (line: UDF Version) at the top of the UDF Operating system where you run your script? Operating system bitness (32 or 64 bit)? What is the functional level of your domain? That's value domainFunctionality displayed by _AD_ListRootDSEAttributes.au3 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
colombeen Posted September 25, 2014 Posted September 25, 2014 all the info you ask is in my screenshots a few posts back. domainFunctionality = 2
Recommended Posts