Dear all,
A couple of days ago I posted a request but nobody answered it.
I need a task which reports me all the NT users and groups in every
server/database and of course, their permissions.
The following excerpt is a part of the work:
declare @.sql varchar(300)
declare @.USER as char(25)
declare cursor1 cursor fast_forward for
select name from sysusers nolock where isntuser = 1 or isntgroup = 1
open cursor1
fetch next from cursor1 into @.USER
while @.@.fetch_status = 0
BEGIN
set @.sql = ('sp_helprotect NULL, ''' + lTRIM(rTRIM(@.USER)) + '''')
exec (@.sql)
fetch next from cursor1 into @.USER
end
close cursor1
deallocate cursor1
Thanks a lot and regards,Finding a list of server instances is something I haven't had to do before,
so I can't help you there.
sysdatabases lists the databases in an instance.
sysobjects lists the database objects, including tables (U), views (V),
procedures (P), and functions (FN, TF, IF)
sysprotects contains information about permissions, take a look a the
definition of the INFORMATION_SCHEMA.TABLE_PRIVILEGES.
I think syspermissions also contains permissions information.
Good luck! I would purchase a security audit tool instead. That way you
limit your liability and shift the focus of the leeches--oops, I meant
lawyers, to someone with deeper pockets.
It might be easier to generate a database creation script (script all
objects) for each database and parse the output.
"Enric" <Enric@.discussions.microsoft.com> wrote in message
news:7CDE748E-8426-4250-A52D-57DA7798F73E@.microsoft.com...
> Dear all,
> A couple of days ago I posted a request but nobody answered it.
> I need a task which reports me all the NT users and groups in every
> server/database and of course, their permissions.
> The following excerpt is a part of the work:
> declare @.sql varchar(300)
> declare @.USER as char(25)
> declare cursor1 cursor fast_forward for
> select name from sysusers nolock where isntuser = 1 or isntgroup = 1
> open cursor1
> fetch next from cursor1 into @.USER
> while @.@.fetch_status = 0
> BEGIN
> set @.sql = ('sp_helprotect NULL, ''' + lTRIM(rTRIM(@.USER)) + '''')
> exec (@.sql)
> fetch next from cursor1 into @.USER
> end
> close cursor1
> deallocate cursor1
>
> Thanks a lot and regards,
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment