water Posted January 20, 2015 Author Posted January 20, 2015 Looks like it isn't easy to modify the AD UDF but the web seems to offer a few solutions to do it by using Powershell,. Example. 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
ptrex Posted January 21, 2015 Posted January 21, 2015 @Water, Yes PS is taking over control ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
water Posted January 21, 2015 Author Posted January 21, 2015 I know. But the combination of PS and AutoIt is even better 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
ptrex Posted January 21, 2015 Posted January 21, 2015 (edited) @Water Completely agree ! That's why I am still surprised that the Developers did not yet make any move towards that for AU3 Both have their strong domains where as AU3 is much more efficient in GUI's and Windows API's. While PS and .NET have a rich toolset for a lot of stuff that AU3 does not have. So I am riding 2 horses since a few years Edited January 21, 2015 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
jp10558 Posted January 22, 2015 Posted January 22, 2015 You mean you want to extend the AD structure to support NIS? I've been away a bit, but in Server 2008R2, if you have a Server 2008R2 forest, using ADSI Edit, you can create a NISobject and NISMap object without extending the schema. I just want to script calling that ADSI GUI creation, like the create user function if possible.
water Posted January 22, 2015 Author Posted January 22, 2015 Unfortunately I have never used NISobject or NISMap. But maybe you could use function _AD_CreateOU as a template to create the needed function. 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
SpinningCone Posted February 4, 2015 Posted February 4, 2015 I apologize if this has been addressed already but I wasn't able to find anything specific. I'm having trouble with using the UDF to delete objects. I run a cleanup process in autoit that deletes unneeded users which was working fine until we made the migration to Exchange 2013. seems in 2013 Exchange is using the user object as a container for activesync items (like iphones and stuff). This causes the script to fail without error (returns sucess even though the object isn't deleted) . When I go into ADUC to manually delete the user a warning about it containing other objects and unless you check the "Use Delete Subtree server control" it won't delete. is there a way the UDF can be modified to envoke this subtree delete?. I didnt see it addressed in the change log. I'd just use powershell but envoking PS from autoit is pretty clunky.
water Posted February 4, 2015 Author Posted February 4, 2015 At the moment the UDF only deletes the specified object. But IIRC there has been a discussion about this long time ago. I will check how we solved the problem then. 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 February 4, 2015 Author Posted February 4, 2015 Has been discussed >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
water Posted February 4, 2015 Author Posted February 4, 2015 I have never tried it and can't test at the moment. Could you please run: Global $sUser = "Name of the user you want to delete" $aResult = _AD_GetObjectsInOU($sUser) If @error Then MsgBox(0, "Error", "Error " & @error & " occurred!") Else _ArrayDisplay($aResult) Endif If it works we should get a list of objects in the users container. 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
SpinningCone Posted February 5, 2015 Posted February 5, 2015 I have never tried it and can't test at the moment. Could you please run: Global $sUser = "Name of the user you want to delete" $aResult = _AD_GetObjectsInOU($sUser) If @error Then MsgBox(0, "Error", "Error " & @error & " occurred!") Else _ArrayDisplay($aResult) Endif If it works we should get a list of objects in the users container. Sorry for the delay, tried your code. was getting an error but wasn't putting the FQDN. It returns an array with 6 elements. Count, the object name, and 4 blank fields. So it sees something but won't dispaly what they are.
water Posted February 5, 2015 Author Posted February 5, 2015 Do you see 6 rows or 6 columns? Maybe you could post a screenshot? 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
SpinningCone Posted February 6, 2015 Posted February 6, 2015 Do you see 6 rows or 6 columns? Maybe you could post a screenshot? 6 rows '>(username redacted) If I view users as containers in ADUC I can see to active sync device folders ('>) and each has the same named object under them ('>)
water Posted February 6, 2015 Author Posted February 6, 2015 Fine. There seem to be 5 objects assigned to the user. If we expand the query we should get all relevant information to delete the "sub"-objects, right? Global $sUser = "Name of the user you want to delete" $aResult = _AD_GetObjectsInOU($sUser, "(distinguishedname=*)", 2, "distinguishedname") If @error Then MsgBox(0, "Error", "Error " & @error & " occurred!") Else _ArrayDisplay($aResult) Endif 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
SpinningCone Posted February 6, 2015 Posted February 6, 2015 Fine. There seem to be 5 objects assigned to the user. If we expand the query we should get all relevant information to delete the "sub"-objects, right? Global $sUser = "Name of the user you want to delete" $aResult = _AD_GetObjectsInOU($sUser, "(distinguishedname=*)", 2, "distinguishedname") If @error Then MsgBox(0, "Error", "Error " & @error & " occurred!") Else _ArrayDisplay($aResult) Endif OK i guess I don't know how to get that to work. The array now looks like this '> So I see the DN of the folders and activesync objects. so I tried this code to iterate through the array and call delete on them . $aResult = _AD_GetObjectsInOU($sUser, "(distinguishedname=*)", 2, "distinguishedname,objectclass") If @error Then MsgBox(0, "Error", "Error " & @error & " occurred!") Else _ArrayDisplay($aResult) Endif for $i = 2 to UBound($aResult) - 1 $explode = StringSplit($aResult[$i][1],"|") $class = $explode[UBound($explode) - 1] ConsoleWrite("Deleting:" & $aResult[$i][0] & @crlf & "Class: " & $class & @crlf) _AD_DeleteObject($aResult[$i][0],$class) Next _AD_DeleteObject($aResult[1][0],"user") Doing this I get some COM errors - output (condensed) Deleting:CN=ExchangeActiveSyncDevices0ACNF:c4d72d52-287f-4a88-8bc3-a0d9a7f5fe7d,CN=[CN],OU=[OU],OU=[OU],DC=[OU],DC=[DC],DC=[DC]Class: msExchActiveSyncDevices [no com error here for some reason, object not deletedthough] Deleting:CN=iPhone§ApplC8TJ6LZSDPNG,CN=ExchangeActiveSyncDevices0ACNF:c4d72d52-287f-4a88-8bc3-a0d9a7f5fe7d,CN=[CN],OU=[OU],OU=[OU],DC=[OU],DC=[DC],DC=[DC]Class: msExchActiveSyncDevice [no com error here for some reason, object not deletedthough] Deleting:CN=ExchangeActiveSyncDevices,CN=[CN],OU=[OU],OU=[OU],DC=[OU],DC=[DC],DC=[DC]Class: msExchActiveSyncDevices COM Error Encountered in AD tests.au3Description = The directory service can perform the requested operation only on a leaf object. Deleting:CN=iPhone§ApplC8TJ6LZSDPNG,CN=ExchangeActiveSyncDevices,CN=[CN],OU=[OU],OU=[OU],DC=[OU],DC=[DC],DC=[DC]Class: msExchActiveSyncDevice COM Error Encountered in AD tests.au3 Description = Access is denied. [user delete] Description = The directory service can perform the requested operation only on a leaf object. Might come down to an access thing. I can't delete one of the iphone objects inside one of the activesyncdevices folders. Not sure why the other ones won't delete and why the same object appears twice. Also not sure that if i had permission to delete the one that it would take care of all objects inside this user. Also seems weird that i get an acess error since i can perform the delete via subtree in ADUC.
water Posted February 6, 2015 Author Posted February 6, 2015 Unfortunately I have no ActiveSync here to play with. As we do not know how ADUC works under the covers I would suggest to ask the web. As Visual basic is very similar to AutoIt I would use something like this: "active directory delete user activesync visual basic" and see what I get. If there is a VB example script it should be easy to convert to AutoIt. 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
SpinningCone Posted February 6, 2015 Posted February 6, 2015 Unfortunately I have no ActiveSync here to play with. As we do not know how ADUC works under the covers I would suggest to ask the web. As Visual basic is very similar to AutoIt I would use something like this: "active directory delete user activesync visual basic" and see what I get. If there is a VB example script it should be easy to convert to AutoIt. OK , I'll look around. might just start looking at migrating to Powershell. Thanks for the help.
flyingboz Posted February 9, 2015 Posted February 9, 2015 sample _AD_ChangePassword function, Example 1 is failing with error 2, extended -2147352567 I have tried running as a full domain admin and standard user with same results. Any suggestions to debug? I am running latest production version of au3; server domain is 2012r2, fully patched. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.
water Posted February 9, 2015 Author Posted February 9, 2015 Could you please add _AD_ErrorNotify(2) at the top of your script? This way 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
heartilly Posted July 20, 2015 Posted July 20, 2015 I am having issues pulling out homeDrive and homeDirectory values even though there is one on actual AD, other properties is working fine._AD_Open() $aUser = _AD_GetObjectsInOU("", "(&(objectCategory=user)(|(CN=" & $sUser & ")(sAMAccountName=" & $sUser & ")))", 2, "samaccountname, name, userPrincipalName, distinguishedName, department, description, employeeid, title, manager, mail, extensionAttribute1, homeDrive, homeDirectory") _arraydisplay($auser) As you can see on the screenshot there is no values on col11, col12 which is for homedrive and homedirectory is there is something i missed?
Recommended Posts