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
|
<%
Matricule = Request.QueryString("Mat")
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Properties("User ID")= "domaine\user"
objConnection.Properties("Password")= "pwd"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
sql = "Select memberOf, sn, givenname "
sql = sql & "from 'LDAP://domaine' "
sql = sql & " where objectCategory = 'user' "
sql = sql & " and objectClass = 'user' "
sql = sql & " and extensionAttribute8 = '" & Matricule & "' "
objCommand.CommandText = sql
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
Response.Write "<center>"
Response.Write "Liste des groupes de : " & objRecordset.Fields("sn").Value & " " & objRecordset.Fields("givenname").Value & " (" & Matricule & ")<br><br><br>"
Response.Write "</center>"
if not objRecordSet.EOF then
listGroups = ""
listGroups = objRecordset.Fields("memberOf").Value
for i = 0 to uBound(listGroups)
chaine_groupe = listGroups(i)
groupTmp = Mid(chaine_groupe, InStr(chaine_groupe, "CN=") + 3, InStr(chaine_groupe, ",") - 4)
' if groupTmp <> "Admins du domaine" then
strGroupes = strGroupes & groupTmp & "<br>"
' end if
next
Response.Write strGroupes
end if
Set objCommand = Nothing
Set objConnection = Nothing
%> |
Partager