Windows groups from a domain

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

    #1

    Windows groups from a domain

    How can I determine the windows groups from a domain?
    How can I determine all the windows groups to which a user belongs to?
    (WindowsPrincip al says if a user belongs to a specific group. I need a list
    with all the groups).
    Thanks!


  • Arild Bakken

    #2
    Re: Windows groups from a domain

    You can use the System.Director yServices library to get the user:

    DirectoryEntry objUser = new
    DirectoryEntry( "WinNT://domain/username,user") ;

    you can also use LDAP if it is Win2K, but then you'll need to perform a
    search in AD.

    The returned directory entry object has a "groups" method that you can
    invoke (for the WinNT provider - the LDAP provider has a memberOf property
    instead).

    Be aware that the groups method and the memberOf property only return the
    groups that the user is a direct member of, and does not include nested
    groups. For LDAP you'd need to get the tokenGroups property and use the SIDs
    returned to get the groups.


    Arild

    "uiranejeb" <mihai.bejenari u@infoworld.ro> wrote in message
    news:OWIdie5TDH A.3024@tk2msftn gp13.phx.gbl...[color=blue]
    > How can I determine the windows groups from a domain?
    > How can I determine all the windows groups to which a user belongs to?
    > (WindowsPrincip al says if a user belongs to a specific group. I need a[/color]
    list[color=blue]
    > with all the groups).
    > Thanks!
    >
    >[/color]


    Comment

    Working...