Script to find out all the groups contain in the login token for every server principal

Published 17 July 07 08:44 AM | SQL Master 

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.

Comments

# SSQA - SqlServer-QA.net said on July 17, 2007 3:25 PM:

The following query will get you the information to find out the groups that contain user login token

Anonymous comments are disabled

About SQL Master

**__________________________________** 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.

Search

Go

This Blog

«July 2007»
SMTWTFS
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

Syndication