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
| Set conn = CreateObject("ADODB.Connection")
Set fso = CreateObject("Scripting.filesystemObject")
Set sortie = fso.createtextfile("O:\File.csv")
conn.Open "Provider=ADsDSOObject;" _
& "user ID=nameUser;" _
& "password=mdp;" _
& "data source=serverAdress;" _
& "location=ou=Profils,o=FSR,o=Ecole,c=FR;" _
& "Encrypt Password=true;" _
& "ADSI Flag=3;"
Set rs = conn.Execute( _
"<LDAP://serverAdress:53686/ou=Profils,o=FSR,o=Ecole,c=FR>;" _
& "(objectClass=profil);ADsPath,cn,description;subtree")
sortie.writeline "ADsPath" & ";" & "cn" & ";" & "description"
While Not rs.EOF
vVal0 = Replace(rs.Fields(0).Value, ", ", ",")
vVal1 = rs.Fields(1)
vVal2 = rs.Fields(2)
sortie.writeline vVal0 & ";" & vVal1(0) & ";" & vVal2(0)
rs.MoveNext
Wend
sortie.Close
conn.Close |
Partager