david1337 Posted March 8, 2017 Share Posted March 8, 2017 Thanks! I think that I have tried every possible combination now, and can't make it work. How exactly would I extend with your filter into my existing line? Link to comment Share on other sites More sharing options...
water Posted March 8, 2017 Author Share Posted March 8, 2017 $Users = _AD_GetObjectsInOU("OU=Department,OU=Users,OU=topOU,DC=company,DC=local", "(&(objectcategory=person)(objectclass=user)(!userAccountControl:1.2.840.113556.1.4.803:=" & $ADS_UF_ACCOUNTDISABLE & "))") david1337 1 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 Link to comment Share on other sites More sharing options...
david1337 Posted March 8, 2017 Share Posted March 8, 2017 That's perfect, thank you water! Link to comment Share on other sites More sharing options...
water Posted March 8, 2017 Author Share Posted March 8, 2017 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 Link to comment Share on other sites More sharing options...
legend Posted March 8, 2017 Share Posted March 8, 2017 Hi I want to get the attribute: pwdLastSet, so I can see when the user changed his password. I tried : _AD_GetObjectAttribute(@UserName, "pwdLastSet") But without luck, any suggestions :D? Link to comment Share on other sites More sharing options...
water Posted March 8, 2017 Author Share Posted March 8, 2017 Use _AD_GetPasswordInfo. This returns a lot of properties, one of them (#8) being the needed date. 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 Link to comment Share on other sites More sharing options...
legend Posted March 8, 2017 Share Posted March 8, 2017 2 minutes ago, water said: Use _AD_GetPasswordInfo. This returns a lot of properties, one of them (#8) being the needed date. thank's a lot =) Link to comment Share on other sites More sharing options...
legend Posted March 8, 2017 Share Posted March 8, 2017 (edited) . Edited May 23, 2017 by legend Link to comment Share on other sites More sharing options...
water Posted March 8, 2017 Author Share Posted March 8, 2017 How about: #include <AD.au3> #include <Date.au3> _AD_Open() Global $pwInfo = _AD_GetPasswordInfo(@UserName) _AD_Close() _ArrayDisplay($pwinfo) MsgBox(0, "", _DateTimeFormat($pwinfo[8], 0)) 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 Link to comment Share on other sites More sharing options...
Valnurat Posted March 9, 2017 Share Posted March 9, 2017 I have been using this: $aObjManager = _AD_GetObjectsInOU("OU=Users,OU=zz,OU=xx,OU=company,DC=AD,DC=company,DC=ORG","(&(objectclass=person)(objectCategory=person)(StaffManager=TRUE))",2,"displayname", "displayname") for some reason I having trouble with it now. if I use _ArrayDisplay($aObjManager,'') it does just freeze. Does someone know how I can troubleshot this? Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
water Posted March 9, 2017 Author Share Posted March 9, 2017 Try _ArrayDisplay without setting further parameters. Means _ArrayDisplay($aObjManager) Plus check the returncode of _AD_GetObjectsInOU. Do you get an error? 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 Link to comment Share on other sites More sharing options...
Valnurat Posted March 9, 2017 Share Posted March 9, 2017 I did this: $aObjManager = _AD_GetObjectsInOU("OU=Users,OU=zz,OU=xx,OU=company,DC=AD,DC=company,DC=ORG","(&(objectclass=person)(objectCategory=person)(StaffManager=TRUE))",2,"displayname", "displayname") ConsoleWrite('Error=' & @error) If IsArray($aObjManager) Then _ArrayDisplay($aObjManager) EndIf Error=0 and _ArrayDisplay just showing a gray screen. Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
water Posted March 9, 2017 Author Share Posted March 9, 2017 You could write all elements of the array to the console to check the content. 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 Link to comment Share on other sites More sharing options...
Valnurat Posted March 9, 2017 Share Posted March 9, 2017 If I do this: For $i = 1 To $aObjManager[0][0] ConsoleWrite($aObjManager[$i][0]) Next I get this: "C:\Users\Working Apps\Create Consultant.au3" (291) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: For $i = 1 To $aObjManager[0][0] For $i = 1 To ^ ERROR Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
water Posted March 9, 2017 Author Share Posted March 9, 2017 The result is a 1D array. 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 Link to comment Share on other sites More sharing options...
jazzyjeff Posted March 9, 2017 Share Posted March 9, 2017 Water, is it possible to create a function that would add a security group to be a member of another security group? Thanks! Link to comment Share on other sites More sharing options...
jazzyjeff Posted March 9, 2017 Share Posted March 9, 2017 I'm sorry Water. Forget this. I just thought I would try for giggles to use the group where I would insert the user name and the groups added the same. Thanks. Link to comment Share on other sites More sharing options...
MattHiggs Posted May 18, 2017 Share Posted May 18, 2017 (edited) Hey. So I am actually trying to use one of the example scripts that you (water) created to demonstrate this AD udf, the Compare users ad tool, which I have added the information to for the domain I am trying to connect to. Here is the thing: the machine that I working from is NOT domain joined and not even (technically) local to the domain, but I am connected to a vpn which is connected to the domain. I modified the _ADOpen function to include all relevant information concerning the domain, and the script is able to connect (at least I assume so, since the form loads successfully), but I keep getting the error "No users found" when I search for a user that is a member of the domain. Am I doing something wrong or is the initial connection to the domain failing? I should also note that, since "Departments" aren't assigned, I commented out the _Check_access function as well, but I wouldn't think that that would matter as the value which it returns only appears at the top of the script. I am able to interact with the domain from this computer (when using psexec or some other tool), so I know I can connect to the domain, but just don't know why it is failing. Any advice would be awesome. Nevermind. Did not set the dnsdomain name correctly. Edited May 18, 2017 by MattHiggs Link to comment Share on other sites More sharing options...
Teckx Posted July 3, 2017 Share Posted July 3, 2017 Hello all! excellent source of information. I have just joined the masses in automating AD i looked around but didn't see these and curious if it's possible remove all memberships from user modify user description Link to comment Share on other sites More sharing options...
Teckx Posted July 3, 2017 Share Posted July 3, 2017 I'm not at work but now that I think about it I believe there is a modify description one. Tested it today and worked great. Any to remove all memberships? hide from exchange lists? 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