Script VBS AD avec Excel

Fermé
Kristo91 Messages postés 3 Date d'inscription dimanche 24 mai 2009 Statut Membre Dernière intervention 24 mai 2009 - 24 mai 2009 à 21:04
Kristo91 Messages postés 3 Date d'inscription dimanche 24 mai 2009 Statut Membre Dernière intervention 24 mai 2009 - 24 mai 2009 à 21:27
Bonjour,

Je suis acctuellement en train de faire un script vbs pour créer des utilisateurs à partir d'un fichier Excel.
Cependant j'ai un probleme avec la fonction objUser.SetPassword. Je souhaite que ce champ soit rempli par une valeur qui est dans mon tableau Excel. Mais j'obtiens l'erreur suivante : "Cet objet ne gère pas cette propriété ou cette methode : 'objUser.SetPassword' avec le code "800A01B6"

Voici une partie de mon code :

[...]
objUser.GivenName = objExcel.Cells (intRow, 3).Value
objUser.SN = objExcel.Cells (intRow, 4).Value
objUser.SetPassword = objExcel.Cells (intRow, 5).Value <---------- l'érreur est ici
objUser.SetInfo
[...]

Avez vous une soluction??

Merci d'avance
A voir également:

2 réponses

yg_be Messages postés 22692 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 16 avril 2024 1 471
24 mai 2009 à 21:09
et avec ceci ?

objUser.SetPassword ( objExcel.Cells (intRow, 5).Value)

quel est le type de objuser ?
0
Kristo91 Messages postés 3 Date d'inscription dimanche 24 mai 2009 Statut Membre Dernière intervention 24 mai 2009
24 mai 2009 à 21:27
J'ai testé avec votre réponse mais cela n'a pas marcher.

je vous donne le code en entier. Je suis débutant en scripting donc le type d'objUser je vois pas ce que c'est.

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open ("C:\Documents and Settings\Administrateur.SRV-VILGE\Bureau\test\liste_calsse.xls")

intRow = 2

Do Until objExcel.Cells (intRow,1).Value = ""
Set objOU = GetObject("LDAP://ou=1ereS, ou=Eleves, DC=vilgenis")
Set objUser = objOU.Create ("User", "cn=" & objExcel.Cells (intRow, 1).Value)
objUser.SamAccountName = objExcel.Cells (intRow, 2).Value
objUser.GivenName = objExcel.Cells (intRow, 3).Value
objUser.SN = objExcel.Cells (intRow, 4).Value
objUser.SetPassword ( objExcel.Cells (intRow, 5).Value) <--
objUser.SetInfo
objUser.AccountDisabled = FALSE
objUser.SetInfo
intRow = intRow + 1
Loop
objExcel.quit
0