ADS Query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shawn.dba

    ADS Query

    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.compan yname.com/Global Groups/SYS_Authority Global
    Groups/SYS_Authority_B ROKERAGE.

    My code is as follows:
    On Error Resume Next
    gName = "SYS_Authority_ Brokerage"
    ou1 = "Global Groups"
    ou2 = "SYS_Author ity Global Groups"
    Set objGroup = GetObject _
    ("LDAP://cn=" & gName & ",ou=" & ou1 & ", ou=" & ou2 &
    ",dc=uscol,dc=a d,dc=companynam e,dc=com")
    objGroup.GetInf o
    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
  • Luke Zhang [MSFT]

    #2
    RE: ADS Query

    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
    Learn with interactive lessons and technical documentation, earn professional development hours and certifications, and connect with the community.

    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/subscripti...t/default.aspx.
    =============== =============== =============== =====

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



    Comment

    • shawn.dba

      #3
      RE: ADS Query

      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_Authorit y Global
      Groups,ou=Globa l Groups,dc=uscol ,dc=ad,dc=compa ny,dc=com")
      objContainer.Fi lter = 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_Authorit y_Brokerage,
      ou=SYS_Authorit y Global Groups,ou=Globa l
      Groups,dc=uscol ,dc=ad,dc=compa ny,dc=com")
      objMember.GetIn fo
      arrMemberOf = objMember.GetEx ("Member")
      For Each strMember in arrMemberOf
      WScript.echo strMember
      Next
      '************** *************** ******END

      Comment

      • Luke Zhang [MSFT]

        #4
        RE: ADS Query

        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
        Learn with interactive lessons and technical documentation, earn professional development hours and certifications, and connect with the community.

        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/subscripti...t/default.aspx.
        =============== =============== =============== =====

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



        Comment

        • Luke Zhang [MSFT]

          #5
          RE: ADS Query

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

          Set objContainer = GetObject("LDAP ://ou=SYS_Authorit y Global
          Groups,ou=Globa l Groups,dc=uscol ,dc=ad,dc=compa ny,dc=com")
          objContainer.Fi lter = Array( "Group" )
          For Each objGroup In objContainer

          WScript.Echo "Group: " & objGroup.Name

          objGroup.GetInf o

          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
          Learn with interactive lessons and technical documentation, earn professional development hours and certifications, and connect with the community.

          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/subscripti...t/default.aspx.
          =============== =============== =============== =====

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



          Comment

          • Luke Zhang [MSFT]

            #6
            RE: ADS Query

            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
            Learn with interactive lessons and technical documentation, earn professional development hours and certifications, and connect with the community.

            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/subscripti...t/default.aspx.
            =============== =============== =============== =====

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



            Comment

            Working...