Script to find SQL Server Login group members(Built-In\Administrators)
July 26, 2011
Posted by on
Would you ever asked to find all administrators with sysadmin access in your server then there is a very symple query you can write
SELECT name,sysadmin FROM sys.syslogins
The above query not just displays the individual logins but also the login groups have admin access
But there are some logins like BUILT-IN\Administrators or some other login groups from your active directory where there are multiple login memebers associated with it, they are called members. then below query is useful to find the members in a login group.
EXEC xp_logininfo 'BUILTIN\Administrators'
The total login from above two queries would be your total login ids having admin access.