araneon Posted September 6, 2016 Posted September 6, 2016 I just compiled _AD_JoinDomain.au3 in test.exe and ran it. And then such an error Function _AD_Open encountered a problem. @error = 4, @extended = -2147023541
water Posted September 6, 2016 Author Posted September 6, 2016 You need to modify _AD_Open. The example script is only running on a PC that is already joined to a domain. It allows to join ANOTHER PC to a domain. 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
araneon Posted September 6, 2016 Posted September 6, 2016 ie parameters _AD Open I need to specify a domain account, and domain itself? I understand correctly?
water Posted September 6, 2016 Author Posted September 6, 2016 Correct. Please see the Wiki for details. 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
AdamUL Posted September 26, 2016 Posted September 26, 2016 I've noticed an issue when running a 32-bit script on 64-bit with the AD UDF. When I run the following, _AD_Open fails with @error = 4 and @extended = -2147023541. _AD_Open() If @error Then Exit 4 + _FileWriteLog($sLogFilePath, "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) ;0x5 Exit Code For $i = UBound($aFile, 1) - 1 To 1 Step -1 If Not _AD_ObjectExists($aFile[$i][0] & "$") Then _ArrayDelete($aFile, $i) Next _AD_Close() When I add the DNS Domain, Host Server, and Configuration parameters, the script runs without issue. Global Const $sDNSDomain = "DC=ad,DC=domain,DC=edu" Global Const $sHostServer = "ad.domain.edu" Global Const $sConfiguration = "CN=Configuration,DC=ad,DC=domain,DC=edu" _AD_Open("", "", $sDNSDomain, $sHostServer, $sConfiguration) If @error Then Exit 4 + _FileWriteLog($sLogFilePath, "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) ;0x5 Exit Code For $i = UBound($aFile, 1) - 1 To 1 Step -1 If Not _AD_ObjectExists($aFile[$i][0] & "$") Then _ArrayDelete($aFile, $i) Next _AD_Close() I'm not sure if there is something in the UDF, or if it is just a quirk when running a 32-bit script on 64-bit. I thought I would report it, in case someone else has this issue. Adam
water Posted September 26, 2016 Author Posted September 26, 2016 Maybe your problem is described here in the wiki (section _AD_Open): https://www.autoitscript.com/wiki/Active_Directory_UDF_-_General#AD_Open 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
AdamUL Posted September 26, 2016 Posted September 26, 2016 Reading that part of the wiki is were I got the idea to try entering the add the DNS Domain, Host Server, and Configuration parameters. Though the section does not mention anything about 32 and 64 bit. The script worked fine, with the default _AD_Open with no parameters, when run as 32 bit on 32 bit, and 64 bit on 64 bit, but not on 32 bit on 64 bit. Adam
water Posted September 26, 2016 Author Posted September 26, 2016 I'm running Windows 7 64 bit and never had a problem when using the AD UDF with 32 or 64 bit. Will test tomorrow to make sure. Which version of Windows do you run? 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
AdamUL Posted September 26, 2016 Posted September 26, 2016 (edited) Windows Server 2008 R2 Datacenter SP1 64 bit AutoIt v3.3.12.0 AD UDF 1.4.6.0 Adam Edited September 26, 2016 by AdamUL
AdamUL Posted September 26, 2016 Posted September 26, 2016 (edited) You got me thinking, and a read through my script. I believe that I have found the issue. It is an issue with the AD UDF and SysWOW64 redirection being disabled. The script will reproduce the error. If you switch the _AD_Open call to the one specifying the DNS Domain, Host Server, and Configuration parameters, set to your domain, the script will not error out while redirection is disabled. #include <AD.au3> #include <WinAPIFiles.au3> ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) ;Delete PCs from the file that are no longer in AD. Global Const $sDNSDomain = "DC=ad,DC=domain,DC=edu" Global Const $sHostServer = "ad.domain.edu" Global Const $sConfiguration = "CN=Configuration,DC=ad,DC=domain,DC=edu" _AD_Open("") ;will error. ;~ _AD_Open("", "", $sDNSDomain, $sHostServer, $sConfiguration) ;Will not error with redirection turned off. If @error Then MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) Else MsgBox(0, "Active Directory Example Skript", "Function _AD_Open successful.") EndIf _AD_Close() Adam Edited September 27, 2016 by AdamUL
water Posted September 27, 2016 Author Posted September 27, 2016 Glad the problem could be solved 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
AdamUL Posted September 27, 2016 Posted September 27, 2016 I glad I was able to find out what was causing the issue, and it was not the AD UDF. Hopefully this will help someone in the future. Adam
water Posted September 27, 2016 Author Posted September 27, 2016 Thanks! I have added this problem to the wiki and linked to your post. 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
Tal0nius Posted October 5, 2016 Posted October 5, 2016 (edited) Hello Water , Is it possible to have an Script like ur ADCU 3.2.0.3 but if user have groups inside groups can u add fonction when click on group open list of groups member of . in array of another listview ? sorry for my english . i try it alone but i too hard for me Edited October 5, 2016 by Tal0nius
water Posted October 5, 2016 Author Posted October 5, 2016 SHould be possible with a "User Function" when you click on a group name in the listview. But I've never tried before and unfortunately do not have spare time to play with it at the moment. 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
ILoveCoding Posted October 20, 2016 Posted October 20, 2016 Guys - I have used the AD scrips often... and it works great! .. but I just tried it on a Windows 2016 Server and it fails with a simple Create User function? I get a failed message with return code -2147352567 Even the Example Script (Modified slightly below) fails. Global $sOU , $sUser _AD_Open() If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) $sOU = "OU=Users,OU=CPT,OU=Locations,OU=AMSOLONE,DC=amsolone,DC=local" $sUser = "Test" Global $iValue = _AD_CreateUser($sOU, $sUser, "Test User") If $iValue = 1 Then MsgBox(64, "Active Directory Functions - Example 1", "User '" & $sUser & "' in OU '" & $sOU & "' successfully created") ElseIf @error = 1 Then MsgBox(64, "Active Directory Functions - Example 1", "User '" & $sUser & "' already exists") ElseIf @error = 2 Then MsgBox(64, "Active Directory Functions - Example 1", "OU '" & $sOU & "' does not exist") ElseIf @error = 3 Then MsgBox(64, "Active Directory Functions - Example 1", "Value for CN (e.g. Lastname Firstname) is missing") ElseIf @error = 4 Then MsgBox(64, "Active Directory Functions - Example 1", "Value for $sAD_User is missing") Else MsgBox(64, "Active Directory Functions - Example 1", "Return code '" & @error & "' from Active Directory") EndIf _AD_Close()
water Posted October 20, 2016 Author Posted October 20, 2016 Will check after my vacation (appr. 1 week) ILoveCoding 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
ILoveCoding Posted October 21, 2016 Posted October 21, 2016 Hi Water, Just some feedback. It was late last night and I was tired - so blame it on that - Anyway, ....... I tried to run the program I wrote to add some users to AD, directly on the Windows 2016 server when I received the error listed above ( return code -2147352567 ) Once I joined a PC to the domain, and ran the script from the PC - it worked 100% :-) Enjoy your leave and your UDF honestly rocks! Best thing ever!
water Posted October 27, 2016 Author Posted October 27, 2016 On 20.10.2016 at 4:40 PM, ILoveCoding said: -2147352567 This stands for "Unexpected error". Might be a permission problem or anything else MS can't give us more details about. Glad you like the AD 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
Lazegalli Posted November 2, 2016 Posted November 2, 2016 Hello Water, I use your AD UDF for several Years now and it's really the best custom UDF for AD Manipulation. Nevertheless I have a small Problem: I want to read the Value of the AD Attribute "ms-Mcs-AdmPwd" with the Function "_AD_GetObjectAttribute()". Sadly I always get an empty Value, although the Attribute is filled and @error is zero. If I call the Function "_AD_GetObjectProperties()" to get all Attributes, the Values are shown properly. I did my Tests with the latest Version of AD.au3 (1.4.6.0). Do you have an Idea, how to solve this Problem? Thanks in advance for your Support. Cheers Lazegalli
Recommended Posts