You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECTr.nameAS role,
m.nameAS name,
m.type_descAS descript,
master.dbo.fn_varbintohexstr(m.sid) AS sid_hex
FROMsys.server_principals m
LEFT JOINsys.server_role_members rm
ONm.principal_id=rm.member_principal_idLEFT JOINsys.server_principals r
ONrm.role_principal_id=r.principal_idWHERE (m.name NOT LIKE'#%'ANDm.name NOT LIKE'NT %')
AND (m.is_disabled!=1)
AND (m.type_descIN ('WINDOWS_GROUP','WINDOWS_LOGIN'))
Sample Output:
role name descript sid_hex
-------- ------------------- ------------- ----------------------------------------------------------
sysadmin DOMAIN\Group WINDOWS_GROUP 0x0105000000000005150000005b7bb0f398aa2245ad4a1ca451040000
NULL DOMAIN\Domain Users WINDOWS_GROUP 0x0105000000000005150000005b7bb0f398aa2245ad4a1ca401020000