Script to find out all the groups contain in the login token for every server principal
The following query will get you the information to find out the groups that contain user login token on that server principal:
SELECT name, usage, type FROM sys.login_token
ORDER BY usage, type, name
go
To find any Windows principal in the token that has an entry in SQL Server server_principals view try:
SELECT login.name, token.sid, token.type
FROM sys.login_token token, sys.server_principals login
WHERE
token.sid = login.sid
AND
( token.type = 'WINDOWS LOGIN' OR token.type = 'WINDOWS GROUP' )
THe above query will get you information about windows groups including Administrators group.
**__________________________________**
SQL Server MVP, Sr. DBA & industry expert.
-
Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it. It is also a power and you will gain by sharing it.