list MSSQL and windows permissions

bibi92
bibi92 used Ask the Experts™
on
Hello,

I search a powershell script allowing me to list the permissions MS SQLSERVER and Windows.

Thanks

bibi
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
try this

select * From fn_my_permissions(NULL, 'database') --  persmision for database
select * From fn_my_permissions('dbo', 'schema') -- permision for schemas
select * From fn_my_permissions('dbo', 'object') -- permission for tables

Open in new window


or
select dp.NAME AS principal_name,
           dp.type_desc AS principal_type_desc,
           o.NAME AS object_name,
           p.permission_name,
           p.state_desc AS permission_state_desc
   from    sys.database_permissions p
   left    OUTER JOIN sys.all_objects o
   on     p.major_id = o.OBJECT_ID
   inner   JOIN sys.database_principals dp
   on     p.grantee_principal_id = dp.principal_id

Open in new window


source: http://consultingblogs.emc.com/jamiethomson/archive/2007/02/09/SQL-Server-2005_3A00_-View-all-permissions--_2800_2_2900_.aspx

Commented:
sorry i missed Powershell!

Author

Commented:
Ok thanks, but how can I check windows permissions?

Thanks

bibi

Commented:
I don't think you can list Windows permissions from SQL Server... ( actually I never saw something like that, maybe I am wrong! )

Have a look at this link,
Understanding Windows NTFS Permissions

Author

Commented:
Thanks bibi

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial