DBA - Find Members of AD Group in SQL Server

Sometime a user comes to you and ask you that he does not have permission on some table. You start checking if that user has required permission on object but you do not see user account but AD group added as User in your database but you are not sure if User is part of this AD group. To Find out quickly the members of AD Group we use below statement.


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

xp_logininfo also can be use to find out what Windows group a particular window user is member of.

 EXEC master.dbo.xp_logininfo 'DomainName\UserName'