Announcement

Collapse
No announcement yet.

Find domain for user from Active Directory

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Find domain for user from Active Directory

    I wrote a java code to search for users from Active Directory server.
    I got the user list but dont know the domain to which each user belongs.
    How can the domain of the user be found from Active Directory programatically.

    One method thought of is :

    1)Get the distinguished name of user from Active Directory.
    2)Parse the distinguished name.
    3)Get the substring that starts the first instance of "DC=".
    4)Strip off the "DC=" at the beginning.
    5)Replace all instances of ",DC=" with a "."
    6)What is left is the DNS domain name of the user.

    Is this reliable.
    Please suggest some other solution.

  • #2
    Re: Find domain for user from Active Directory

    I assume you have multiple directories the search could find things in, or are you wanting to create a script that you can take into any organisation ?
    Please do show your appreciation to those who assist you by leaving Rep Point https://www.petri.com/forums/core/im.../icon_beer.gif

    Comment


    • #3
      Re: Find domain for user from Active Directory

      Yes I have multiple directories.I am searching on a Global Catalog server.

      Comment


      • #4
        Re: Find domain for user from Active Directory

        dsget user may be able to help.. but your solution sounds like it would be effective also... i just can't code to save my life :P
        Please do show your appreciation to those who assist you by leaving Rep Point https://www.petri.com/forums/core/im.../icon_beer.gif

        Comment

        Working...
        X