bonjour
le code pour cree un user en vbs marche bien sauf quand je veux rajouter un objet dans la fiche du user:
le script hors delphi marche sans aucun probleme,j'ai du oublier quelque chose pour que ca marche en delphi
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 procedure TForm1.Button2Click(Sender: TObject); var c:TScriptControl; nom,prenom,loggin,psw:string; begin ADOTable1.First; while not ADOTable1.Eof do begin nom:=ADOTable1.Fields[1].AsString; prenom:= ADOTable1.Fields[2].AsString; loggin:=ADOTable1.Fields[3].AsString; psw:=ADOTable1.Fields[4].AsString; c := TScriptControl.Create(Self); try c.Language := 'VBScript'; c.AddCode('Set objdomaine = GetObject("LDAP://ou=Ecole Primaire,dc=ecolesks,dc=local")'); c.AddCode (' Set objUser = objdomaine.Create("User", "cn= '+ nom +'")') ; c.AddCode('objUser.Put "sAMAccountName",''+ loggin '+'') ;-> ici ca plante //c.AddCode('objUser.Put "givenName",'+ prenom +'') ; //c.AddCode('objUser.Put "sn", nom ') //c.AddCode('objUser.Put "displayName", nom & prenom ') //c.AddCode('objuser.Put "profilePath", "\\Serveur02\Profils$\%username%"') c.AddCode(' objUser.SetInfo'); //c.AddCode('objUser.SetPassword mdp') ADOTable1.Next; finally c.Free; end; end; end;
merci
a+
Partager