LLI Wiki — My Digital Knowledge Base

List the members of the sysadmin role

Query listing the logins that belong to the fixed server role sysadmin, with their disabled status.

This query lists the logins that are direct members of the fixed server role sysadmin, with their disabled status.

SELECT 'Name' = sp.NAME
    ,sp.is_disabled AS [Is_disabled]
FROM sys.server_role_members rm
    ,sys.server_principals sp
WHERE rm.role_principal_id = SUSER_ID('Sysadmin')
    AND rm.member_principal_id = sp.principal_id

Notes

Mastodon LLIMastodon SocialFosstodon