Jump to content

Problem with AD.au3


Recommended Posts

I am having issues with this -- ran simple script:

#include<AD.au3>

_ad_Open()

_ad_SamAccountNameToFQDN("SYSTOCRCCTX01-N$")

_ad_Close()

MsgBox(0,"",@error)

-----------------------------------------

COM error handler returns this:

COM Error Encountered in testAD.au3

Scriptline = 395

NumberHex = 000000A9

Number = 169

WinDescription = Variable must be of type 'Object'.

Description = Operation is not allowed when the object is closed.

Source = ADODB.Connection

HelpFile = C:\WINDOWS\HELP\ADO270.CHM

HelpContext = 1240653

LastDllError = 0

---------------------------------------------

AD.au3:

Line 394: Local $oAD_RecordSet = $oAD_Connection.Execute($sAD_Query)

Line 395: If $oAD_RecordSet.RecordCount = 1 Then

Any ideas as to why this is failing? I've been going NUTS! The adfunctions.au3 worked perfectly up until about late Jan.2010 -- now they seem to all be broken > even in previously compiled executables!

Link to comment
Share on other sites

#include <AD.au3>
_ad_Open()
_ad_SamAccountNameToFQDN("SYSTOCRCCTX01-N$")
_ad_Close()
MsgBox(0,"",@error)

using Autoit 3.3.6.0

AD UDFS from water 0.37

this works for me:

log from scite:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /AU3Check /in "C:\Documents and Settings\user\Рабочий стол\AD 0.37\test.au3"
+>01:59:13 Starting AutoIt3Wrapper v.2.0.0.3    Environment(Language:0419 Keyboard:00000409 OS:WIN_XP/Service Pack 2 CPU:X64 OS:X86)
>Running AU3Check (1.54.19.0) from:C:\Program Files\AutoIt3
+>01:59:14 AU3Check ended.rc:0
+>01:59:14 AutoIt3Wrapper Finished
>Exit code: 0   Time: 0.846
[size="5"] [/size]
Link to comment
Share on other sites

I assume it's the SamAccountName of a computer (due to the $).

Based on the error message I think it's a problem with authorization.

What version of the AD UDF do you run? - please check line 9 of the UDF.

Your demo script just runs fine here (AutoIt 3.3.6.0 and AD UDF version 0.37). The SamAccountName doesn't exist here so I get @error = 1.

I modified your demo to display the error of _AD_Open and _AD_SamAccountNameToFQDN. Could you please run the modified version and post the result?

#include <AD.au3>
$R = _ad_Open()
MsgBox(0,"","_AD_Open Result: " & $R & " error: " & @error)
$R = _ad_SamAccountNameToFQDN("SYSTOCRCCTX01-N$")
MsgBox(0,"","_AD_SamAccountNameToFQDN Result: " & $R & " error: " & @error)
_ad_Close()

What version of Active Directory do you run?

Could you please run the example script _AD_ListRootDSEAttributes.au3 and post the results? If it's Windows 2000 I might need to change the error handling in _AD_SamAccountNameToFQDN.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Version of AD.au3: ; UDF Version ...: 0.37

Result of Modified version:

_AD_Open Result: 0 error: 3

_AD_SamAccountNameToFQDN Result: error: 1

Result of _AD_ListRootDSEAttributes.au3:

>Running:(3.3.4.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Program Files\AutoIt3\Include\_AD_ListRootDSEAttributes.au3"

C:\Program Files\AutoIt3\Include\AD.au3 (1310) : ==> Error in expression.:

$aAD_Attributes[1] = $oAD_RootDSE.Get("configurationNamingContext")

$aAD_Attributes[1] = ^ ERROR

->07:22:55 AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 1.762

Mixed AD environment: Server2003 & Server2008....

Link to comment
Share on other sites

_AD_Open Result: 0 error: 3

I see: @error = 3 means:

"Open the connection to AD failed. @extended set to error code received by the COM error handler. Happens when the User doesn't have query / modify access"

I think you'll have to connect to the AD with user credentials with the appropriate rights.

Could you please run this code:

#include <AD.au3>
$R = _ad_Open()
MsgBox(0,"","_AD_Open Result: " & $R & ", error: " & @error & ", extended: " & @extended)
_ad_Close()
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

hmmmm....my default credentials should have admin access to AD, but I'll try specifically supplying them and see what happens...

To supply some, but not other parameters should I supply a -1 or ""?

Results:

_AD_Open Result: 0, error: 3, extended: -2147352567

Edited by ekotek
Link to comment
Share on other sites

To supply some, but not other parameters should I supply a -1 or ""?

Results:

_AD_Open Result: 0, error: 3, extended: -2147352567

Just use
$R = _AD_Open("userid","password")

-2147352567 equals to 0x8002009 which means "DISP_E_EXCEPTION - Unanticipated error occurred". Unfortunately this doesn't help much.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Or you could download Sysinternals (now M$) ADFind and try to connect with this tool.

Just download and run the exe - no installation required. If there are any connection problems it tells exacle what the problem is.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

What happens when you run the example script _AD_Open.au3?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

"The logon was not successful!

@error: 3, @extended: -2147352567"

This, regardless of whether I choose Windows Login Name:, NetBIOS Login Name:, or User Principal Name:....

Also, regardless of providing of DNSDomain, HostServer, and/or Configuration...

Link to comment
Share on other sites

Now I'm running out of ideas!

  • Have you ever successfully cconnected to the AD using my AD UDF?
  • Could you test it on another PC?
  • What operating system are you running?
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

I know, right? I don't know what's going on....

I have not been able to connect using the AD UDF before...I was able to connect using the adfunctions.au3 UDF, but that now fails as well...ever since I reinstalled AutoIt on my system...

I can test it on another...

I am running WindowsXPsp3

Link to comment
Share on other sites

I get the impression that Sysinternal's ADFind tool uses a different way to connect to the AD (because ADFind works and AutoIt doesn't).

It might be a problem with the ADsDSOObject Provider on your system. So maybe it runs on another machine.

What version of AutoIt do you run?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Do you want to install the latest AutoIt 3.3.6.0 version (it's working fine here) and test again?

If this doesn't work reinstall 3.2.12.1 and if this doesn't work reinstall your PC?

I think it's a problem with Windows XP and the ADsDSOObject Provider.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

I am having the same problem with AutoIT3.3.6.1 -- I noticed on the 3.2.12.1 machine that when running _AD_Open.au3, the DNSDomain, HostServer, and COnfiguration information is all populated when I start running it.

On the "bad" machine, it's all blank...

Link to comment
Share on other sites

Okay...I found the issue -- turns out it had nothing to do with your UDF -- my installation of MDAC was corrupt...had to repair it. Now everything is working perfectly.

Sorry to have taken up so much of your time on this -- I suppose it's good to know though, should anyone else come across the same issue....

Thanks for everything...

ekotek.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...