Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Capture_Login_Auths

By Donald Patterson,

This is an enhancement to the sp_helprevlogin stored procedure.  As a DBA I'm always asked to grant access to an account based on another and it can be difficult at times.   

This procedure takes in a login name, windows or SQL, and will generate the access and authorities for the login across the SQL instance.  The script generates the user's login, any server roles the login may have, database access and database roles that have been granted, and any specific permissions granted on the database and authorities granted on objects.  Everything gets outputed onto the message tab.  The output can be copied into a query window and with a replace of the login id, access can be quickly granted to another user.  
 
 If the login name is not provided, an error will be generated
 
 EX - sp_capture_login_auths 'domain name\snooze' 
 
 EX - sp_capture_login_auths 'snooze'

Total article views: 2824 | Views in the last 30 days: 5
 
Related Articles
FORUM

grant access to all databases

grant access to all databases

FORUM

How to grant a login access to that db when that db is in "StandBy /ReadOnly" mode?

How to grant a login access to that db when that db is in "StandBy /ReadOnly" mode?

FORUM

auto generate logins

auto generate logins

FORUM

Generating SQL Logins\users and permissions for a database

Generating SQL Logins\users and permissions for a database

FORUM

Auditing Logins and Their Access

Looking for T-SQL scripts that will show logins, rights and database they have access too

Tags
 
Contribute