6

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?

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
amateur
  • 43,371
  • 65
  • 192
  • 320
  • Is "another server" in a different domain? If so, then how you're doing it is how you do it (other than establishing an RDP session and opening SSMS on the other server). – Aaron Bertrand Jul 21 '13 at 20:07
  • If I were you I would create a shortcut to the command you have listed. Call it `SSMS Domain` or something similar. That way you hide the command and it will look very similar to the normal SSMS shortcut. – Kenneth Fisher Jul 21 '13 at 21:35

3 Answers3

3

The only elegant ways to connect to a SQL Server in another domain but still use Windows Authentication are:

  • What you're already doing: runas /netonly
  • Connecting via remote desktop and opening SSMS locally on the remote server
Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
1

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.

Ben Thul
  • 31,080
  • 4
  • 45
  • 68
0

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
    

    Run as different user

  • 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.

Drew Chapin
  • 7,779
  • 5
  • 58
  • 84