Jump to content

Active Directory UDF - Help & Support


water
 Share

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.

Link to comment
Share on other sites

  • 2 weeks later...

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

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

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

@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()
Link to comment
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
Link to comment
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

Link to comment
Share on other sites

Version 0.38 has been released.

For download please see signature.

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 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 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 example script runs fine here. Can you please post a copy of the error messages?

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

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

Link to comment
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 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 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?

Link to comment
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 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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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