Sunday 11 November 2012

Identifying Active directory group members using TSQL on MS SQL Server

exec master.dbo.xp_logininfo 'DomainName\GroupName','members'

Prerequisites: Requires membership in the sysadmin role for the database server.
Requires EXECUTE permission for this stored procedure within the master database.

P.S.
By experiments, I  noticed that I could enumerate only members for groups to which I belong.

2 comments:

  1. The following error message occurred: "Execute permission was denied on the object 'xp_logininfo' "

    ReplyDelete
    Replies
    1. Thanks Tarek for the feedback, I believe you need to have execute permission on this object within the master schema.

      Delete