Skip to content

Instantly share code, notes, and snippets.

@michaeljbailey
Created October 22, 2014 14:23
Show Gist options
  • Save michaeljbailey/f0ea47818cc44951be8e to your computer and use it in GitHub Desktop.
Save michaeljbailey/f0ea47818cc44951be8e to your computer and use it in GitHub Desktop.
Finds all users in the sysadmin role that are not the sa account or are NT Services.
SELECT name
FROM master.sys.syslogins [Login]
WHERE [Login].[sysadmin] = 1
AND [name] <> 'sa'
AND [name] NOT LIKE 'NT Service%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment