Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Problem with AD.au3


  • Please log in to reply
19 replies to this topic

#1 ekotek

ekotek

    Seeker

  • Active Members
  • 24 posts

Posted 09 March 2010 - 09:41 PM

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!







#2 gcue

gcue

    just a wannabe

  • Active Members
  • PipPipPipPipPipPip
  • 1,872 posts

Posted 09 March 2010 - 10:00 PM

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

i also tried using chr(36) same issue

#3 Fire

Fire

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 364 posts

Posted 09 March 2010 - 10:01 PM

#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


#4 water

water

    ?

  • MVPs
  • 15,072 posts

Posted 10 March 2010 - 07:46 AM

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, 10 March 2010 - 12:07 PM.

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2013-11-10 - Version 0.10.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:

ADO - Wiki


#5 ekotek

ekotek

    Seeker

  • Active Members
  • 24 posts

Posted 10 March 2010 - 01:25 PM

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

#6 water

water

    ?

  • MVPs
  • 15,072 posts

Posted 10 March 2010 - 03:23 PM

_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, 10 March 2010 - 03:33 PM.

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2013-11-10 - Version 0.10.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:

ADO - Wiki


#7 ekotek

ekotek

    Seeker

  • Active Members
  • 24 posts

Posted 10 March 2010 - 03:34 PM

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, 10 March 2010 - 03:42 PM.


#8 water

water

    ?

  • MVPs
  • 15,072 posts

Posted 10 March 2010 - 04:16 PM

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, 10 March 2010 - 04:43 PM.

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2013-11-10 - Version 0.10.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:

ADO - Wiki


#9 ekotek

ekotek

    Seeker

  • Active Members
  • 24 posts

Posted 10 March 2010 - 04:56 PM

Same issue when supplying username and password...

#10 water

water

    ?

  • MVPs
  • 15,072 posts

Posted 10 March 2010 - 05:00 PM

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, 10 March 2010 - 05:13 PM.

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2013-11-10 - Version 0.10.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:

ADO - Wiki


#11 ekotek

ekotek

    Seeker

  • Active Members
  • 24 posts

Posted 10 March 2010 - 05:42 PM

Connected without a problem, providing AD server name with no credentials...
-by the way, thanks for all the quick responses on this...

#12 water

water

    ?

  • MVPs
  • 15,072 posts

Posted 10 March 2010 - 05:44 PM

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

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2013-11-10 - Version 0.10.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:

ADO - Wiki


#13 ekotek

ekotek

    Seeker

  • Active Members
  • 24 posts

Posted 10 March 2010 - 05:54 PM

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

#14 water

water

    ?

  • MVPs
  • 15,072 posts

Posted 10 March 2010 - 05:57 PM

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, 10 March 2010 - 05:59 PM.

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2013-11-10 - Version 0.10.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:

ADO - Wiki


#15 ekotek

ekotek

    Seeker

  • Active Members
  • 24 posts

Posted 10 March 2010 - 05:59 PM

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

#16 water

water

    ?

  • MVPs
  • 15,072 posts

Posted 10 March 2010 - 06:04 PM

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?

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2013-11-10 - Version 0.10.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:

ADO - Wiki


#17 ekotek

ekotek

    Seeker

  • Active Members
  • 24 posts

Posted 10 March 2010 - 06:05 PM

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

#18 water

water

    ?

  • MVPs
  • 15,072 posts

Posted 10 March 2010 - 06:13 PM

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.

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2013-11-10 - Version 0.10.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:

ADO - Wiki


#19 ekotek

ekotek

    Seeker

  • Active Members
  • 24 posts

Posted 10 March 2010 - 07:08 PM

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

#20 ekotek

ekotek

    Seeker

  • Active Members
  • 24 posts

Posted 10 March 2010 - 09:23 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users