how to get the Domain group name based on the login name

  • When a Domain Group is added it gives access to all its group members.

    gut how to find Domain Group to whcih the Loged in user belongs to ?

  • From a stackoverflow article, OPENQUERY is used to query the active directory

    select *

    from OpenQuery(ADSI,

    'SELECT objectCategory, cn, sn, mail, name, department

    FROM ''LDAP://Mydomain/CN=users,DC=wl-domain,DC=com''

    WHERE MemberOf=''cn=_____GROUPNAME_____,CN=users,DC=Mydomain,DC=com''

    ORDER BY cn'

    )

    Replace your domain names and it should work.

    Be sure to test before running in production.

    ______________________________________________________________________________________________
    Forum posting etiquette.[/url] Get your answers faster.

  • and another way, via an extended stored proc:

    EXEC master..xp_logininfo

    @acctname = 'mydomain\lowell',

    @option = 'all' -- Show all paths a user gets his auth from

    go

    EXEC master..xp_logininfo

    @acctname = 'mydomain\authenticatedusers',

    @option = 'members' -- show group members

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply