Checking for users with sysadmin privileges

Category : Scripts User Rating : 4.5 Stars      Views : 4.5 Stars
One Click Feedback
Please help us to improve the site by rating the quality of this article by clicking a button below.




One thing I like to do occasionally, or when “inheriting” a new SQL server, is to check which users have sysadmin privileges. As these users have access to perform any activity in SQL Server it’s important to keep the number of these users to a minimum especially on production systems.

The following script will list all sysadmins on a server, in name order :
SELECT   name,type_desc,is_disabled
FROM     master.sys.server_principals
WHERE    IS_SRVROLEMEMBER ('sysadmin',name) = 1
ORDER BY name


Related Articles

The following articles may also be of interest :

Link back to this article : http://www.sqlmatters.com/Articles/Checking for users with sysadmin privileges.aspx

Keywords

SQL,scripts,sysadmin,security,audit


Comments
Post by Sudhakar on Thu 22 Oct 2015 22:06. Report Inappropriate Post

Thanks for the script. It helped to get information of accounts.
Post by Vutisani on Mon 08 Feb 2016 10:16. Report Inappropriate Post

wow good one.
Post by anon on Fri 27 May 2016 10:23. Report Inappropriate Post

thanks!!

Post a comment   No login required !

 
Name :   Email :   Website :  
Will be displayed alongside your comment
Not displayed Optional, but displayed if entered