Jump to content
Sign in to follow this  
water

Active Directory UDF - Help & Support

Recommended Posts

Great excuses. Function _AD_DisablePasswordExpire works perfectly. But Func _AD_DisablePasswordChange doesnt work at all :(

After

$Result = _AD_DisablePasswordChange("username")
ConsoleWrite("Result: " & $Result & ", error: " & @error & ", extended: " & @extended)

i have Result: 0, error: -2147352567, extended: 0

Thank you for support.

Share this post


Link to post
Share on other sites

Hi water,

Problems with _AD_GetObjectsInOU.

Searchscope param base and onelevel doesn't work. I got always subtree results.

Client: XP SP3, Autoit 3.3.4.0, AD.au3 0.37

AD Win2003 SP2.

Regards

Stefan

Share this post


Link to post
Share on other sites

@deeptrancer

Error: -2147352567 (hex: 80020009: DISP_E_EXCEPTION - Unanticipated error occurred) usually means you have no write access to the AD.

This is not very specific because AD doesn't return any further information (or this information is not accessible by AutoIt).

Could you please check that you have full access to the AD by using the Microsoft MMC to set the option in AD?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

@ 99ojo

I see. Could you please change line 1098 from

$oAD_Command.CommandText = ";" & $sAD_Filter & ";" & $sAD_DataToRetrieve & ";subtree"
to
$oAD_Command.CommandText = ";" & $sAD_Filter & ";" & $sAD_DataToRetrieve
and then post the test results? Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hello, is it possible to specify a username and password when connecting to AD?

can AdOpen be used with, $sAD_UserIdParam and $sAD_PasswordParam?

but what is the correct way to use them?

Thanks for any help :(

Yes you can. Please have a look at _AD_Open.htm. It describes the parameters you can use and the format of the parameters.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Can it be used like this?

do i have to specify

$SDNSDomain, $SHostServer, $SConfiguration?

$SUserid =("user1")
$SPassword=("password1")


_AD_Open($SUserId, $SPassword,)

;rest of application under:

Thanks

Share this post


Link to post
Share on other sites

@Erlend

#include <AD.au3>
#include <Array.au3>

;Full Name: John Doe
;UserAccount: JD
;Password: 1234

; Open Connection to the Active Directory
_AD_Open("JD", "1234")
If @error = 0 Then
    MsgBox(64, "Active Directory Functions", "We didn't receive a COM error - the logon was succcessful!") ;This comes everytime because @error is always 0. A COM error comes below in example 1.
Else
    MsgBox(16, "Active Directory Functions", "The logon was not succcessful!" & @CRLF & @CRLF & "@error: " & @error & ", @extended: " & @extended)
EndIf

; *****************************************************************************
; Example 1
; Get a list of all Domain Controllers in the Active Directory
; *****************************************************************************
Global $aDC
$aDC = _AD_ListDomainControllers()
_ArrayDisplay($aDC, "Active Directory Functions - Example 1 - All Domain Controllers, distinguished name, DNS host name, and the site name")

; *****************************************************************************
; Example 2
; Get a list of all Sites Names
; *****************************************************************************
Global $aSite
_ArraySort($aDC, 0, 1, 0, 3)
$aSite = _ArrayUnique($aDC, 4, 1)
_ArrayDisplay($aSite, "Active Directory Functions - Example 2 - All Site Names")

; Close Connection to the Active Directory
_AD_Close()

Share this post


Link to post
Share on other sites

Hi Water!

There seems to be a (little, I hope) problem with _AD_GetObjectsInOU() in the current version 0.37 -

querying for groups returns an empty array... In the older version 0.33 _AD_GetObjectsInOU() it works normal.

Here's my test code:

#include <Array.au3>
#include ".\..\AUTOIT\Include\Water\AD\AD.au3"
#include ".\_AD_GetObjectsInOU_OLD.au3" ; AD.au3 V0.33

_AD_Open()

Global $test1
Global $test2
Global $test3[1]

$test1 = _AD_GetObjectsInOU("DC=de01,DC=itvollmann,DC=com", "(&(objectCategory=group))", 2)
_ArrayDisplay($test1, "1")

$test2 = _AD_GetObjectsInOU("DC=de01,DC=itvollmann,DC=com", "(&(objectCategory=group))", 2, "samAccountName,samAccountName")
_ArrayDisplay($test2, "2")

_AD_GetObjectsInOU_OLD($test3, "DC=de01,DC=itvollmann,DC=com", "(&(objectCategory=group))", 2)
_ArrayDisplay($test3, "3")

_AD_Close()

The result of the second test is a bit strange.

Even when specified "samAccountName," (mind the comma!) it works,

but this will result in a 2D array...

This problem occurs no matter which filter (name=*, objectCategory=group, objectCategory=user, etc.) I use.

This could be a problem with the array handling in this function...??? May be you can help me fixing this flaw.

Greets,

Happy Eastern!,

-supersonic.

Edited by supersonic

Share this post


Link to post
Share on other sites

Hi,

have you changed:

Known bugs: (last updated: 2010-03-28)

•_AD_GetObjectsInOU: Returns an empty array when the parameter $sAD_DataToRetrieve consists of a single value.

As a workaround please replace $aAD_DataToRetrieve with $sAD_DataToRetrieve in line 1129, 1130 and 1133

See:

http://www.autoitscript.com/forum/index.php?showtopic=106163

;-))

Stefan

Share this post


Link to post
Share on other sites

Version 0.38 has been released.

For download please see signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Version 0.38 has been released.

For download please see signature.

just tried

_AD_CreateMailbox.au3

and I get an error when opening it.

But I love these scripts has made my life a bit easier.

Share this post


Link to post
Share on other sites

What error do you get?

  • COM error?
  • Or return value <> 1? If yes, what is @error and @extended set to?
  • How do you call the funcion? Which parameters do you provide?
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

oh sorry, lol I was at work and a customer came in so I didnt have a chance to look at it thoroughly.

but it was in the

_AD_CreateMailbox.au3

example script.

Just yelling at my for some local variables not being declared.

Share this post


Link to post
Share on other sites

The example script runs fine here. Can you please post a copy of the error messages?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

it gives me an error that says

Line 37 (File

"C:\path\autoit\_AD_CreateMailbox.au3");

$IMailbox = GUICtrlCreatInput($SMailbox,241,40,259,21)

$Mailbox = GUICtrlCreareInput(^ERROR

Error: Variable used without being declared

I tried declaring the variable same error. I think im doing something stupid. Maybe it cant find the exchange server or something

Share this post


Link to post
Share on other sites

I will have a look at it as soon as I return from vacation. Due to the volcano in Island this could take some time - at least 1 week.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I rewrote my script so it uses AD.au3 instead of ADFunctions.au3. Everything is working as expected except for _AD_MoveObject. I added the error logging from the example script and get a -2147352567 from Active Directory. I can manually move the object without any problems. I am also removing all the groups from the user, disabling the account and changing the password without issues.

Any Ideas?

Share this post


Link to post
Share on other sites

I rewrote my script so it uses AD.au3 instead of ADFunctions.au3. Everything is working as expected except for _AD_MoveObject. I added the error logging from the example script and get a -2147352567 from Active Directory. I can manually move the object without any problems. I am also removing all the groups from the user, disabling the account and changing the password without issues.

Any Ideas?

Can you please post the code you use? You can strip it down to the _AD_Open and _AD_MoveObject calls.

What do you move? A User or a Computer? If it's a computer you have to append a "$" to the computers name.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...