Impersonate while scripting or running external commands?

Single-click script execution on multiple SQL Servers.

Moderators: JonathanWatts, Anu Deshpande, dlkj, Colin Millerchip, Michelle Taylor

Impersonate while scripting or running external commands?

Postby fredr1k » Thu Apr 03, 2008 10:24 am

hi,

I'm evaluating Multiscript and found it quite nice. But we are performing some tasks that would require me to try to log in as another user and report back the result and optionally make some queries.

Another sugestion, how about a feature to populate the serverlist with a SQL-query? I'm not a big fan of using the serverlist. In that case it would be easy to populate the serverlist with specific servers.
fredr1k
 
Posts: 2
Joined: Thu Apr 03, 2008 9:58 am

Postby dlkj » Thu Apr 03, 2008 1:20 pm

Hi,

There are a couple of ways to impersonate users using Transact-SQL

SQL 2000:
Code: Select all
SETUSER [ 'username' [ WITH NORESET ] ]

http://msdn2.microsoft.com/en-us/library/ms186297.aspx

SQL 2005:
Code: Select all
{ EXEC | EXECUTE ] AS <context_specification>
[;]

<context_specification>::=
{ LOGIN | USER } = 'name'
    [ WITH { NO REVERT | COOKIE INTO @varbinary_variable } ]
| CALLER

http://msdn2.microsoft.com/en-us/library/ms181362.aspx

Thanks for the feedback on the serverlist, this is already something we are considering for a future release of SQL Multi Script.

--
Daniel
dlkj
 
Posts: 151
Joined: Tue Aug 14, 2007 5:10 pm
Location: Red Gate Software, Cambridge

Postby fredr1k » Fri Apr 04, 2008 8:38 am

Daniel,

Thanks for the input. I was totaly unaware of this command :) However it doesnt suite my needs. As a part of a security check i need to connect to the databases to check wether they have some obvious passwords on uses like SA etc. This forces me to make full sql-logon's to the system.

I'm pleased to hear about the population feature of the serverlist. In an enviroment similar to the one I'm sitting on right now it's not unusual with a sql-serverlist of 200+ machines. :)
fredr1k
 
Posts: 2
Joined: Thu Apr 03, 2008 9:58 am


Return to SQL Multi Script 1

Who is online

Users browsing this forum: No registered users and 0 guests