ADS Query

S

shawn.dba

Hello. Thank you in advance for your time.

I'm trying to query a set of groups in ActiveDirectory and output the
members of each group. I'm not receiving output. The object tab of one
object is listed as
uscol.ad.companyname.com/Global Groups/SYS_Authority Global
Groups/SYS_Authority_BROKERAGE.

My code is as follows:
On Error Resume Next
gName = "SYS_Authority_Brokerage"
ou1 = "Global Groups"
ou2 = "SYS_Authority Global Groups"
Set objGroup = GetObject _
("LDAP://cn=" & gName & ",ou=" & ou1 & ", ou=" & ou2 &
",dc=uscol,dc=ad,dc=companyname,dc=com")
objGroup.GetInfo
arrMemberOf = objGroup.GetEx("Member")
Response.Write ""
Response.Write gName
Response.Write "<td>"
For Each strMember in arrMemberOf
Response.Write strMember
Response.Write "<br>"
Next
arrMemberOf = 0
Response.Write "</td>"
 
L

Luke Zhang [MSFT]

Hello Shawn,

You may convert your code in VBScript code, (a .vbs file), and use Msgbox
to output the values, can this give correct value or some error message?
..VBS file is excuted in command prompt window and use current logged on
user's permssion. An asp application may lack of permission to query AD.

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

shawn.dba

Luke,

Great idea! It worked very well. I found that I had a simple error in my
LDAP string. Thanks so much. I have a more complex (and hopefully relevant)
question. I've created two scripts; one to search for groups within an OU
and one to search for members within a group. I'd like to search for groups
within an OU and members within each of those groups - in other words I'd
like to combine these two arrays with the end reselt being:
Group1 Member1
Member2
Group2 Member1
Group3 Member1

'**** Search for Groups****BEGIN
Set objContainer = GetObject("LDAP://ou=SYS_Authority Global
Groups,ou=Global Groups,dc=uscol,dc=ad,dc=company,dc=com")
objContainer.Filter = Array( "Group" )
For Each objGroup In objContainer
WScript.Echo "Group: " & objGroup.Name
Next
'**********************END

'****Search for members within a group****BEGIN
Set objMember = GetObject ("LDAP://cn=SYS_Authority_Brokerage,
ou=SYS_Authority Global Groups,ou=Global
Groups,dc=uscol,dc=ad,dc=company,dc=com")
objMember.GetInfo
arrMemberOf = objMember.GetEx("Member")
For Each strMember in arrMemberOf
WScript.echo strMember
Next
'***********************************END
 
L

Luke Zhang [MSFT]

Thank you for the update. I am gald to hear the problem has been found. :)

If you have further questions, please feel free to let us know.

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
L

Luke Zhang [MSFT]

For the second question, will following script work for the issue:

Set objContainer = GetObject("LDAP://ou=SYS_Authority Global
Groups,ou=Global Groups,dc=uscol,dc=ad,dc=company,dc=com")
objContainer.Filter = Array( "Group" )
For Each objGroup In objContainer

WScript.Echo "Group: " & objGroup.Name

objGroup.GetInfo

arrMemberOf = objGroup.GetEx("member")


For Each strMember in arrMemberOf
WScript.echo strMember

Next


Next


Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
L

Luke Zhang [MSFT]

Hello,

Is the suggestion in my previous message helpful on the issue? If you have
any further question, please feel free to let us know.

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top