Options

Impersonate while scripting or running external commands?

fredr1kfredr1k Posts: 3
edited April 4, 2008 3:38AM in SQL Multi Script
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.

Comments

  • Options
    Hi,

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

    SQL 2000:
    SETUSER [ 'username' [ WITH NORESET ] ]
    
    http://msdn2.microsoft.com/en-us/library/ms186297.aspx

    SQL 2005:
    { 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
  • Options
    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. :)
Sign In or Register to comment.