Reputation: 44673
I am working with Management studio and I want to log in to databases located on another server in another domain. The only login I have for such is with Windows credentials.
I want to be able to log in via Management Studio on my local PC. I have found the only way to do so is using a command similar to:
runas /netonly /user:domain\username "C:\Progr...\IDE\Ssms.exe"
While this works, it isn't the easiest or nicest way. Is there a better way? Any way I can do it within Management Studio?
Upvotes: 6
Views: 8426
Reputation: 8009
You can get a graphical password prompt by downloading ShellRunAs or better yet, the entire Sysinternals Suite.
Store the executable(s) for ShellRunAs or the Sysinternals Suite in a location of your choice. I recommend:
C:\Program Files\Sysinternals
You can then enable a "Run as different user..." context menu option for all applications/shortcuts by running
shellrunas /reg
If you want to only enable this for SQL Server Management Studio, you can create a shortcut to it and pass the path the management studio like so:
"C:\Program Files\Sysinternals\ShellRunas.exe" "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"
If you download the entire Sysinternal Suite, I would recommend you add the directory to your PATH environment variable.
Please note that you will need to adjust the paths above based on your SQL Server Management Studio version and whether you're running 64 bit or 32 bit Windows.
Upvotes: 0
Reputation: 32737
In addition to the other answers you've received, you can also shift-right click on an executable or a shortcut to one and in the resulting context menu, there should be an option to run as a different user. I tried this on my Win 7 machine. I seem to recall that in XP, I had to install ShellRunAs for these options to show up.
Upvotes: 1
Reputation: 280644
The only elegant ways to connect to a SQL Server in another domain but still use Windows Authentication are:
runas /netonly
Upvotes: 3