Meilleur auteur de réponses
Connexion Base ADAM

Question
-
Bonjour,
Je me connecte sur un serveur adam avec la commande :
$connection = [adsi]LDAP://Server:numPort/OU=OUX,DC=yyy,DC=xxx,DC=zzz,"domaine\user","mdp"
$connection.FindAll()
Tout fonctionne, par contre si je veux que mes paramétres soit stocké avec un index cela ne fonctionne plus
avec bien entendu les même paramétre dans mon index
Le parametre du port est une variable $GroupRoo
$connection = "LDAP://$IndexAD.LDAPHostName:$IndexAD.LDAPTcpPort/$GroupRoo,'$IndexAD.LDAPBindDN','$IndexAD.LDAPBindPwd'"
$connection.FindAll()
Avez-vous une idée?
Merci de votre aide
Réponses
-
Bonjour,
Quand vous faites ce code :
$connection = [adsi]"LDAP://Server:numPort/OU=OUX,DC=yyy,DC=xxx,DC=zzz","domaine\user","mdp"
Vous instanciez un objet de la classe System.DirectoryServices.DirectoryEntry. Cette instanciation est réalisée en appelant un cosntruteur de cette classe (c.f link) et plus précisement, ce construteur DirectoryEntry(String, String, String)
Vous avez donc besoin de trois valeurs et pas d'une seule valeur de type System.String
Voici la solution :
$connection = [ADSI]"LDAP://$($IndexAD.LDAPHostName):$($IndexAD.LDAPTcpPort)/$GroupRoo",$IndexAD.LDAPBindDN,$IndexAD.LDAPBindPwd
Ou bien
$connection = New-Object System.DirectoryServices.DirectoryEntry -ArgumentList "LDAP://$($IndexAD.LDAPHostName):$($IndexAD.LDAPTcpPort)/$GroupRoo",$IndexAD.LDAPBindDN,$IndexAD.LDAPBindPwd
J'espère avoir été clair dans mes explications.
Bien Cordialement, Richard Lazaro.
- Modifié Richard Lazaro mercredi 4 janvier 2012 15:54
- Proposé comme réponse Richard Lazaro mercredi 4 janvier 2012 16:10
- Marqué comme réponse patmarti mercredi 4 janvier 2012 16:13
Toutes les réponses
-
Bonjour,
Quand vous faites ce code :
$connection = [adsi]"LDAP://Server:numPort/OU=OUX,DC=yyy,DC=xxx,DC=zzz","domaine\user","mdp"
Vous instanciez un objet de la classe System.DirectoryServices.DirectoryEntry. Cette instanciation est réalisée en appelant un cosntruteur de cette classe (c.f link) et plus précisement, ce construteur DirectoryEntry(String, String, String)
Vous avez donc besoin de trois valeurs et pas d'une seule valeur de type System.String
Voici la solution :
$connection = [ADSI]"LDAP://$($IndexAD.LDAPHostName):$($IndexAD.LDAPTcpPort)/$GroupRoo",$IndexAD.LDAPBindDN,$IndexAD.LDAPBindPwd
Ou bien
$connection = New-Object System.DirectoryServices.DirectoryEntry -ArgumentList "LDAP://$($IndexAD.LDAPHostName):$($IndexAD.LDAPTcpPort)/$GroupRoo",$IndexAD.LDAPBindDN,$IndexAD.LDAPBindPwd
J'espère avoir été clair dans mes explications.
Bien Cordialement, Richard Lazaro.
- Modifié Richard Lazaro mercredi 4 janvier 2012 15:54
- Proposé comme réponse Richard Lazaro mercredi 4 janvier 2012 16:10
- Marqué comme réponse patmarti mercredi 4 janvier 2012 16:13
-
-
Bonjour,
Merci pour votre retour.
Cordialement,
Florin
Florin CIUCA, MSFT
Votez! Appel à la contribution
Nous vous prions de considérer que dans le cadre de ce forum on n’offre pas de support technique et aucune garantie de la part de Microsoft ne peut être offerte.