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 40 41 42 43 44
| On Error Resume Next
strGrp = "Nom_Groupe1;Nom_Groupe2;Nom_Groupe3;"
ArrGrps = Split(strGrp, ";")
Set objExcel = CreateObject("Excel.Application")
Set ObjFso = CreateObject("Scripting.FileSystemObject")
For k = 0 to Ubound(ArrGrps) - 1
Set objGroup = GetObject("LDAP://cn=" & ArrGrps(k) & ",ou=Groups,OU=.../...,dc=.../...,dc=com")
WScript.Echo "Groupe traité : " & ArrGrps(k)
WScript.Echo "****************************************"
For Each strUser in objGroup.Member
Set objUser = GetObject("LDAP://" & strUser)
Wscript.Echo " - " & objUser.CN & ", " & objUser.Class
If UCase(objUser.Class) = "GROUP" Then
XtractNom = objUser.ADSPath
Xtract
End If
Next
Next
WScript.Quit
Sub Xtract
Set objGroup2 = GetObject(XtractNom)
For Each strUsers in objGroup2.Member
Set objUsers = GetObject("LDAP://" & strUsers)
If UCase(objUsers.Class) = "GROUP" Then
WScript.Echo " - " & objUsers.CN & ", " & objUsers.Class
XtractNom = objUser.ADSPath
Xtract
Else
WScript.Echo " - " & objUsers.CN & ", " & objUsers.Class
End If
Next
End Sub |