ADS Query

Discussion in 'ASP General' started by shawn.dba, Jul 19, 2006.

  1. shawn.dba

    shawn.dba Guest

    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>"

    --
    Shawn Burton
    shawn.dba, Jul 19, 2006
    #1
    1. Advertising

  2. 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.
    Luke Zhang [MSFT], Jul 19, 2006
    #2
    1. Advertising

  3. shawn.dba

    shawn.dba Guest

    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
    shawn.dba, Jul 20, 2006
    #3
  4. 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.
    Luke Zhang [MSFT], Jul 21, 2006
    #4
  5. 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.
    Luke Zhang [MSFT], Jul 21, 2006
    #5
  6. 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.
    Luke Zhang [MSFT], Jul 25, 2006
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ray5531
    Replies:
    1
    Views:
    1,618
    Marc Jennings
    Apr 4, 2005
  2. Ray5531

    ads by google

    Ray5531, May 10, 2005, in forum: ASP .Net
    Replies:
    9
    Views:
    479
    Alan Silver
    May 17, 2005
  3. Chad Beckner
    Replies:
    3
    Views:
    10,021
    Chad Beckner
    Aug 11, 2005
  4. apondu
    Replies:
    1
    Views:
    344
    Alexey Smirnov
    Jul 3, 2007
  5. apondu

    Query on User Authentication aganist ADS

    apondu, Jul 3, 2007, in forum: ASP .Net Security
    Replies:
    0
    Views:
    99
    apondu
    Jul 3, 2007
Loading...

Share This Page