Problem mit adfunctions.au3

  • Hallo,

    Ich nutze folgendenen Include. Wobei, hierbei fängt es schon an, denn aus dem Include geht nicht hervor, ob es die Version 3.1.1. oder 3.1.2 ist....

    Code
    ; Active Directory Function Library. Include this to allow access to Active Directory Functions ; Author : Jonthan Clelland ; Email : jclelland@statestreet.com ; Version : 3.1.1 ;Version History -- Starting from v3.1 ; 3.1 -- First released version ; 3.1.1 -- Bugfix to _ADGetObjectsInOU, default $filter value caused errors. Has been changed. ; 3.1.2 -- Corrections made to comments, replaced occurrences of 'Samaccountname' with 'Full Distringuished Name' where this had changed ibn the code. ; 3.1.2 -- Change to '_ADUserCreateMailbox', added '$emaildomain' and removed the hard-coded Email Domain name. ; _ADDoError : Error event handler for COM errors. This is global so will pick up errors from your program if you include this library ; _ADCreateUser : Creates a user in a particular OU ; _ADCreateGroup : Creates a group in a particular OU ; _ADAddUserToGroup : Adds a user to a group (if the user is not already a member of the group) ; _ADRemoveUserFromGroup : Removes a user from a group ; _ADObjectExists : Returns 1 if the given object (SamAccountName) exists in the local AD Tree ; _ADModifyAttribute : Sets the attribute of the given object to the value specified ; _ADIsMemberOf : Returns 1 if the


    Mein Script sieht so aus:

    Code
    #include ; Bsp.: IsMemberOf("AD Gruppenname",@username) If _ADIsMemberOf("groupall",@username) = 1 then MsgBox(0, "AD","User in der Gruppe") Else MsgBox(0, "AD","User nicht in der Gruppe") EndIf


    Wenn ich dann das Programm starte, erhalte ich folgende Fehlermeldung:


    We intercepted a COM Error !

    Number is:80072032

    Windescription: Es wurde eine ungültige dn-Syntax angegeben.

    Script Line number is 283

  • Die Funktion:


    ; Active Directory Function Library. Include this to allow access to Active Directory Functions

    ; Author : Jonthan Clelland
    ; Email : jclelland@statestreet.com
    ; Version : 3.1.1

    ;Version History -- Starting from v3.1

    ; 3.1 -- First released version
    ; 3.1.1 -- Bugfix to _ADGetObjectsInOU, default $filter value caused errors. Has been changed.
    ; 3.1.2 -- Corrections made to comments, replaced occurrences of 'Samaccountname' with 'Full Distringuished Name' where this had changed ibn the code.
    ; 3.1.2 -- Change to '_ADUserCreateMailbox', added '$emaildomain' and removed the hard-coded Email Domain name.

    ; _ADDoError : Error event handler for COM errors. This is global so will pick up errors from your program if you include this library
    ; _ADCreateUser : Creates a user in a particular OU
    ; _ADCreateGroup : Creates a group in a particular OU
    ; _ADAddUserToGroup : Adds a user to a group (if the user is not already a member of the group)
    ; _ADRemoveUserFromGroup : Removes a user from a group
    ; _ADObjectExists : Returns 1 if the given object (SamAccountName) exists in the local AD Tree
    ; _ADModifyAttribute : Sets the attribute of the given object to the value specified
    ; _ADIsMemberOf : Returns 1 if the


    Mein Skript:

    #include <adfunctions.au3>

    ; Bsp.: IsMemberOf("AD Gruppenname",@username)

    If _ADIsMemberOf("nesgroupall",@username) = 1 then

    MsgBox(0, "AD","User in der Gruppe")
    Else
    MsgBox(0, "AD","User nicht in der Gruppe")
    EndIf

  • Also bei uns geht das so wie Du es in Deinem Beispiel beschrieben hast.
    Aber von einem Rechner der in der Domäne ist und mit "Domänen-Admin"-Recht !

    Zur Nutzung dieses Forum's, ist ein Übersetzer für folgende Begriffe unerlässlich:

    "On-Bort, weier, verscheiden, schädliges, Butten steyling, näckstet, Parr, Porblem, scripe, Kompletenz, harken, manuel zu extramieren, geckukt, würglich, excell, acces oder Compilevorgeng"

  • Bei uns ist zur Zeit noch eine W2000-AD-Domäne im Einsatz. Aber eigentlich sollte das ja kompatibel sein ?!
    Der Fehler deutet auf einen fehlerhaften "distinguished name" bei der LDAP-Abfrage hin.

    Du könntest bevor Du eine _ADIsMemberOf()-Abfrage ausführst, einmal 2 Dinge probieren:

    1. MsgBox(0,"",$strDNSDomain)
    Sollte den DNS-Domainnamen im Format "dc=xxxx, dc=xx" zurückgeben.

    2. MsgBox(0,"",_ADSamAccountNameToFQDN("Gruppe"))
    Sollte den "fully qualified domain name" der Gruppe zurückgeben.
    Sollte so etwas wie "dn=xxx, ou=xxxx, dc=xxxx, dc=xx" zurückkommen.

    Zur Nutzung dieses Forum's, ist ein Übersetzer für folgende Begriffe unerlässlich:

    "On-Bort, weier, verscheiden, schädliges, Butten steyling, näckstet, Parr, Porblem, scripe, Kompletenz, harken, manuel zu extramieren, geckukt, würglich, excell, acces oder Compilevorgeng"