Sign in to follow this  
Followers 0

Problem with AD.au3

20 posts in this topic

#1 ·  Posted

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!

Share this post


Link to post
Share on other sites



#2 ·  Posted

def has to do with the "$" in the account name..

i also tried using chr(36) same issue

Share this post


Link to post
Share on other sites

#3 ·  Posted

#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]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#5 ·  Posted

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....

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

_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:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#9 ·  Posted

Same issue when supplying username and password...

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#11 ·  Posted

Connected without a problem, providing AD server name with no credentials...

-by the way, thanks for all the quick responses on this...

Share this post


Link to post
Share on other sites

#12 ·  Posted

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


My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#13 ·  Posted

"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...

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

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:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#15 ·  Posted

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

Share this post


Link to post
Share on other sites

#16 ·  Posted

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:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#17 ·  Posted

It runs perfectly on a machine with AutoIt 3.2.12.1 installed...

On the "problem" machine, I am running AutoIt 3.3.4.0

Share this post


Link to post
Share on other sites

#18 ·  Posted

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:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#19 ·  Posted

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...

Share this post


Link to post
Share on other sites

#20 ·  Posted

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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0