Jump to content

Active Directory UDF


water
 Share

Recommended Posts

Is this a special group? What's the name of the group?

How many members are in the group?

Can you post the exact line where you call _AD_GetGroupMembers?

 

This is the result of simply executing the file _AD_GetGroupMembers.au3 from the Zip file I downloaded from the top post.

I think I remember that this example would list all the groups I (the currently logged-in user) am a member of.

Sorry if I'm not very clear, english is not my native language.

As for my own code, I added trace lines in my program, and it crashes right when calling _AD_GetGroupMembers()

The group I used in this case is not a special group, and is called "DTV MTL GG Sysmans SYS", and there are 9 members in this group.

@@ Trace(402) :        $aMembers = _AD_GetGroupMembers($sOU)
"C:\Program Files (x86)\AutoIt3\Include\AD.au3" (1095) : ==> Subscript used on non-accessible variable.:
$aMembers[$iCount2] = $aMembersadd[$iCount2 - $iRangeModifier - 1]
$aMembers[$iCount2] = $aMembersadd^ ERROR
->11:06:09 AutoIt3.exe ended.rc:1
>Exit code: 1    Time: 16.902

This is the surrounding code:

$aObjects = _AD_GetObjectsInOU("", "(&(objectclass=group)(cn=" & $GroupName & "))", 2, "distinguishedName") ; getting a 2 dimensionnal array in $agroups. 1st dimension contains groups names, 2nd one contains groups descriptions

    If @error > 0 Then
        _GUICtrlStatusBar_SetText($StatusBar1, "Erreur.")
        MsgBox(64, "Fonctions Active Directory", "Le groupe " & $GroupName & " n'a pas été retrouvé dans l'AD.")
        _AD_Close() ; On ferme la connexion
        Exit ; et on sort...
    EndIf

    ; Normalement, on devrait avoir le FQDN dans l'élément 1 de l'array qui a été retourné par la fonction _AD_GetObjectsInOU().

    If Not IsArray($aObjects) Then
        _GUICtrlStatusBar_SetText($StatusBar1, "Erreur.")
        MsgBox(64, "Fonctions Active Directory", "La recherche du groupe " & $GroupName & " n'a pas retourné un résultat valide....  désolé!")
        _AD_Close() ; On ferme la connexion
        Exit ; et on sort...
    EndIf

    ; Dans la (seule) position de l'array, on devrait avoir le FQDN du groupe qu'on veut...

    $sOU = $aObjects[1]

    ; Puis on va chercher les membres du groupe en question.

    _GUICtrlStatusBar_SetText($StatusBar1, "Interrogation du membership du groupe.")
    $aMembers = _AD_GetGroupMembers($sOU)

    If @error > 0 Then
        _GUICtrlStatusBar_SetText($StatusBar1, "Erreur.")
        MsgBox(64, "Fonctions Active Directory", "Le groupe '" & $GroupName & "' ne semble pas avoir de membres.")
        _AD_Close() ; On ferme la connexion avec l'AD
        Return ; Et on retourne à la boucle principale..
    Else
        If Not IsArray($aMembers) Then ; On s'assure d'avoir bien un array comme résultat..
            _GUICtrlStatusBar_SetText($StatusBar1, "Erreur.")
            MsgBox(64, "Fonctions Active Directory", "La recherche du groupe " & $GroupName & " n'a pas retourné un résultat valide....  désolé!")
            _AD_Close() ; On ferme la connexion
            Return ; et on sort...
        Else
            _ArraySort($aMembers, 0, 1) ; On trie les membres par ordre alphabétique.
            $TotalSteps = $aMembers[0] ; On ramasse le nombre total de membres pour la progressbar
        EndIf
    EndIf

    _GUICtrlStatusBar_SetText($StatusBar1, "Nombre total de membres: " & $TotalSteps)

Note that the compiled executable I currently have on my desktop (AutoIt 3.3.8.1 and AD Functions 1.3.0.0) is working very well.

Thanks for your time...  I really appreciate it!

Kyo

Link to comment
Share on other sites

I will investigate and hope to return with a result quite soon ...

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Bug found.

AutoIt now supports keyword Null. So the UDF needs to be modified.

Change line 1092 to:

If $aMembersadd = Null Then ExitLoop

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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 same is true for line 1205.

If $aMembersadd = Null Then ExitLoop

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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'm glad the problem could be solved :)

Happend in functions written by the original author of the UDF I haven't changed yet.

I hope that's the only bug ...

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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. How i can change user first, last name, phone, e-mail, office & other if i use AD.au3. 

I do not want to use cmd and dsmod user -fn -mi -ln -office -tel -email...
In this thread, I have not found an answer to your question.
 
Link to comment
Share on other sites

Welcome to Autoit and the forum!

Something like this:

#include <AD:au3>
_AD_Open()
_AD_ModifyAttribute($sUser, "GivenName", "New First Name")
_AD_Close()

If the first name is part of the FQDN then you need to rename the object.

The mail address can't be changed in AD, you need to change the mailbox name in Exchange.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Welcome to Autoit and the forum!

Something like this:

#include <AD:au3>
_AD_Open()
_AD_ModifyAttribute($sUser, "GivenName", "New First Name")
_AD_Close()

If the first name is part of the FQDN then you need to rename the object.

The mail address can't be changed in AD, you need to change the mailbox name in Exchange.

 

Thanks, but if i create user from _AD_CreateUser($sOU, $sUser, $Login) then from the AD editor for this user do not appear following items attributes like "GivenName", "middleName", "sn", and many other. 

Link to comment
Share on other sites

You have to set them using _AD_ModifyAttribute.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Ah, then all attributes can be changed using _AD_ModifyAttribute :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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 see.

I need to change that file.

Now you should use the SciTEConfig tool. This wiki page explains how to do.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

  • 2 weeks later...

Does anyone know why I'm getting this error when compiling to an EXE and obfuscating?

 

-###2 Obfuscation Error: Found Execute() statement which will lead to problems running your obfuscated script.
>### current Func: _AD_FixSpecialChars

C:UsersJoeAppDataLocalTempOBsF738.tmp(415,1) Warning for line:$sText = StringRegExpReplace(Execute('"' & StringRegExpReplace($sText, '(*|(|)|(?![[:xdigit:]]{2}))', '" & "" & hex(ascw("$1"),2) &  "') & '"'), '(NUL)', "00")

-#############################################################################################
-#### Obfuscator Found   1 Error(s)!!!!    This means your script could have problems running properly.  ####
-#############################################################################################

 

Any assistance with this is greatly appreciated!!!

-Rastal

Link to comment
Share on other sites

Obfuscator does not like 'Execute'.

Don't obfuscate or insert a 'ignore' line in the AD UDF.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Hi,

Great UDF.

I use it a lot.
Maybe you can add a new function to set the userAccountControl property more easy

At the moment I do it with: _AD_ModifyAttribute($UserUD, "userAccountControl", 512)

 

Here are the values you need:

UF_ACCOUNTDISABLE = 0x0002;

UF_PASSWD_NOTREQD = 0x0020;

UF_PASSWD_CANT_CHANGE = 0x0040;

UF_NORMAL_ACCOUNT = 0x0200;

UF_DONT_EXPIRE_PASSWD = 0x10000;

UF_SMARTCARD_REQUIRED = 0x40000;

UF_PASSWORD_EXPIRED = 0x800000;

 

Kind regards,

Ivo

Edited by Ivo

Ivo

Link to comment
Share on other sites

Any suggestion how to make it easier?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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 will insert the 'ignore' statement' in the next version of the UDF.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

×
×
  • Create New...