I got this script from ZColton. Everything works just great. The script initially returns all the groups in the domain and then links to the users in the groups. I have our department groups in a specific OU:
"Domain Name/Security Groups/Departmental Security Groups"
I can't figure out how to edit the script sucessfully to return just the groups from this OU only. Anybody out there have any ideas so I can continue with my "poor man's phone book"? ) Here's the code I'm working with:
I'm thinking that I need to edit this line:
Com.CommandText ="select adspath,name from 'GC://"+objADsPath+"' WHERE objectCategory='Group'
Oooops! Just figured it out!
Needs to be:
Com.CommandText ="select adspath,name from 'GC://OU=Departmental Security Groups,OU=Security Groups,DC=domain,DC=com' WHERE objectCategory='Group' ORDER BY name"
TT
"Domain Name/Security Groups/Departmental Security Groups"
I can't figure out how to edit the script sucessfully to return just the groups from this OU only. Anybody out there have any ideas so I can continue with my "poor man's phone book"? ) Here's the code I'm working with:
Code:
<%@ Language=VBScript %>
<%
response.buffer = true
SUB CloseAll
rs.close
set rs=nothing
con.close
set con=nothing
END SUB
%>
<html>
<head>
</head>
<body>
<%
groupdsn=request.querystring("group")
if groupdsn="" then
Set objDomain = GetObject ("GC://rootDSE")
objADsPath = objDomain.Get("defaultNamingContext")
Set objDomain = Nothing
Set con = Server.CreateObject("ADODB.Connection")
con.provider ="ADsDSOObject"
con.open "Active Directory Provider"
Set Com = CreateObject("ADODB.Command")
Set Com.ActiveConnection = con
Com.CommandText ="select adspath,name from 'GC://"+objADsPath+"' WHERE objectCategory='Group' ORDER BY name"
Set rs = Com.Execute
if rs.EOF then
Call CloseAll
response.write "No Groups Found."
else
rsarray=rs.getrows
Call CloseAll
numrows=ubound(rsarray,2)
for rowcounter=0 to numrows
response.write "<a href='"+Request.ServerVariables("SCRIPT_NAME")+"?group="+rsarray(1,rowcounter)+"'>"+rsarray(0,rowcounter)+"</a><br>"
next
end if
else
set objgroup=GetObject(groupdsn)
response.write "<b>Members of "+objgroup.cn+"</b><br>"
For each objMember in objGroup.Members
response.write objMember.DisplayName+" - "
response.write objMember.telephonenumber+"<br>"
Next
Set objGroup=nothing
end if
%>
</body>
</html>
I'm thinking that I need to edit this line:
Com.CommandText ="select adspath,name from 'GC://"+objADsPath+"' WHERE objectCategory='Group'
Oooops! Just figured it out!
Needs to be:
Com.CommandText ="select adspath,name from 'GC://OU=Departmental Security Groups,OU=Security Groups,DC=domain,DC=com' WHERE objectCategory='Group' ORDER BY name"
TT