6 Comments

If you want to use Windows Authentication in the Microsoft SQL Server Management Studio to connect to a Microsoft SQL Server in an other domain or with an other username, you can use the RUN AS command in Windows:

runas /noprofile /netonly /user:MyDomain\User1 "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"

This will start the Microsoft SQL Server Management Studio under the account "MyDomain\User1". You’re workstation doesn’t even have to be a member of the domain "MyDomain" as long as you know the correct username and password.

This will work even if there are no trusts between the domains.

 

Bas Kroes, reminded me of the Windows UI “Run as” option in Windows 7:

If you are member of the same domain or there is a trust between the domains, you can just use the Windows UI, by SHIFT + Right click on the shortcut to the Microsoft SQL Server Management Studio in the start menu en choose “Run as different user”:

 

image

 

If you use the UI option and, you are on a different domain with no trust, you will get the following exception:

 

image

“The security database on the server does not have a computer account for this workstation trust relationship”

6 Replies to “Use the "RUN AS" command to let Microsoft SQL Server Management Studio connect with an other Windows account or to an other domain”

  1. I just wanted to say thanks for the post. A lot of other websites said that connecting to a SQL Server via a machine that is not on the same domain or even a workstation that is not on a domain at all, was futile.

    Thanks again

  2. Sample bat file to run Access MDB with links to SQL Server on another domain:

    runas /netonly /user:domain\username “C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE C:\Users\rheitzman\Desktop\GrantDB_2012_beta.accdb”

    (couldn’t figure out how to have spaces in .accdb name)

    To run an VB exe:
    runas /netonly /user:domain\username “C:\ois10\ois10.exe”

    Both prompt for password.

  3. Thanks for the post!

    But,
    When I try to open .sql files on double click when “ran as different user”, it gives “The operation could not be completed. Unspecified Error”.

    Do I need to do something to open .sql files on double click?

  4. Hi,
    I am getting following error. my PC is on different domain and i granted the permission to different domain users and wanted to test these users.

    RUNAS ERROR: Unable to acquire user password

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts

OOP in JavaScript for C# developers

0 Comments

Nice article, explaining OOP in JavaScript for C# developers http://blog.boyet.com/blog/javascriptlessons/javascript-for-c-programmers-prototypes-the-basics/