Link to home
Start Free TrialLog in
Avatar of Pau Lo
Pau Lo

asked on

SQL Server 2008 and 2008 R2 permissions query

I need  a query to list all accounts with access to 2008 and 2008 R2 SQL Servers, to list the group or usernames, account status, ie whether they are active or disabled, and a list of which accounts have been granted anmy of the server level roles, i.e. (sysadmin, serveradmin, securityadmin, processadmin, setupadmin, public etc), and ideally some indication if the account is sql login, windows login or windows group...
ASKER CERTIFIED SOLUTION
Avatar of Vikas Garg
Vikas Garg
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pau Lo
Pau Lo

ASKER

sorry but I wanted ideally everything in one single query.
SELECT
p.name AS [Name] ,r.name,r.type_desc,r.is_disabled,r.create_date , r.modify_date,r.default_database_name,p.type_desc Account_Type
FROM
sys.server_principals r
INNER JOIN sys.server_role_members m ON r.principal_id = m.role_principal_id
INNER JOIN sys.server_principals p ON
p.principal_id = m.member_principal_id

Open in new window

pma111, do you still need help on this question?