jakatak Posted April 7, 2006 Posted April 7, 2006 Hi, I am trying to run a script to read data from a LDAP unix based server. (like openldap) I am trying with objcreate ...but i can't find the proper syntax. Is anybody have done thate before ? Thanks in advance,
chamach Posted April 10, 2006 Posted April 10, 2006 Hi, I am trying to run a script to read data from a LDAP unix based server. (like openldap) I am trying with objcreate ...but i can't find the proper syntax.You'll find two examples below... Sorry for the french comments and variable names, but you won't mind ! Is anybody have done thate before ?Not before, but now ! o Find the users whose names contain the string in the variable "$ValeurRecherche" expandcollapse popup; Parcours LDAP Opt ("TrayIconDebug", 1) Const $LDAPBaseDN = "ou=People,dc=***,dc=***" Const $LDAPPort = "389" Const $LDAPServeur = "***" Const $LDAPUtilisateur = "" Const $LDAPMdP = "" Const $LDAPAdresse = $LDAPServeur & ":" & $LDAPPort & "/" & $LDAPBaseDN $Liste = "" $i = 0 ;~ ----------------------------------------------------------------------- $ValeurRecherche = "toto" ;~ ----------------------------------------------------------------------- SplashTextOn ("Connexion LDAP", "Bind au serveur LDAP " & $LDAPServeur & " en cours...", 300, 50, 50, 50, 16) $debut = TimerInit() $ServeurLDAP = ObjGet ("LDAP://" & $LDAPAdresse) $fin = TimerDiff($debut) If @error Then MsgBox (4096, "Connexion LDAP", "Erreur de connexion à " & $LDAPServeur) Exit (-1) EndIf ;~ Parcours de tous les utilisateurs du LDAP For $Utilisateur In $ServeurLDAP If $Utilisateur.displayname = $ValeurRecherche Then $i = $i + 1 SplashTextOn ("Connexion LDAP", "Bindé à " & $LDAPServeur & " en " & $fin / 1000 & " s" & @CRLF & @CRLF & $Utilisateur.displayName & " trouvé." & "N° " & $i, 300, 90, 50, 50, 16) $Liste = $Liste & $Utilisateur.displayName & @CRLF EndIf Next SplashOff () MsgBox (4096, "Toutes les entrées contenant " & $ValeurRecherche, $Liste) o Display the name of the user given in the InputBox ; Recherche LDAP Const $LDAPBaseDN = "ou=People,dc=***,dc=***" Const $LDAPPort = "389" Const $LDAPServeur = "***" Const $LDAPUtilisateur = "" Const $LDAPMdP = "" Const $LDAPAdresse = "LDAP://" & $LDAPServeur & ":" & $LDAPPort & "/" & $LDAPBaseDN $Liste = 0 $recherche = InputBox ("Nom", "Quel nom d'utilisateur voulez-vous rechercher dans le LDAP ?") $Utilisateur = ObjGet ("LDAP://" & $LDAPServeur & ":" & $LDAPPort & "/uid=" & $recherche & "," & $LDAPBaseDN) If @error Then MsgBox (4096, "Connexion LDAP", "Erreur de connexion à " & $LDAPServeur) Exit (-1) EndIf MsgBox (4096, "", $Utilisateur.displayName) Cervélo Soloist 2004 & Cervélo P3C 2007
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now