SQL Management Studio can't change Windows Auth User (not express)

13,454

You need to use runas .. netonly when starting up SSMS to use Windows Authentication with different credentials (You might need to change the path to the executable depending upon what version you are on)

 runas /user:DOMAIN\USERNAME  /netonly 
"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"

NB: To future readers if you get a generic "invalid credentials" type message when trying this please read the comments trail below!

Share:
13,454
JL.
Author by

JL.

Developer, Designer , Coder

Updated on June 05, 2022

Comments

  • JL.
    JL. about 2 years

    I want to connect to a SQL Database that is on a domain. I can ping the server no problem, and I'm connecting to it from a VPN.

    The problem is in SQL Management Studio, when Windows Authentication is selected (as opposed to SQL Authentication) and this is on the make new connection dialog. The Username field is disabled, so you can't just type in [domain]\username.

    This is a pretty big show stopper for me, but I can't believe management studio is so limited as to not allow you to connect with an account other than logged in user.

    Is there something wrong with my installation or is this the way it is?

    Any work arounds? If not a better tool than SQL Management Studio (which I kinda like).

    Thanks

  • JL.
    JL. over 13 years
    Problem with this is I'm on another domain. So it gives an error message about domain trust.
  • Martin Smith
    Martin Smith over 13 years
    @JL Did you definitely use the /netonly switch? On the linked article it says you will get this message if you forget!
  • JL.
    JL. over 13 years
    Yeah checked , double checked and tried a few other switches. Interesting thing is even while running under the network account, the username box is still showing homeDomain\MyUserName - but its a differant error message to just running it raw.
  • Martin Smith
    Martin Smith over 13 years
    @JL - Yes I get that as well. I need to put in the password for the other user then, when SSMS fires up, the connection box still shows my local user name but it works on the remote domain. Maybe something is a bit more locked down your end? What exact error message do you get and when does it appear?
  • JL.
    JL. over 13 years
    Thanks for help so far, I created a bat, this then prompts me for a password for the domain account. I provide this, ssms fires up, and then the user name and password fields are disabled, but I can see my local account in the background there, no way to change it. I can only click connect which then gives this error.
  • Martin Smith
    Martin Smith over 13 years
    I'm out of ideas on that. Hopefully someone else will spot this question that has had to deal with that issue before!
  • JL.
    JL. over 13 years
    Ok I found the problem. I used another server to debug and test everything in great detail. You need to have correct permission to the server - it will not provide you with a login denied invalid credentials message, if you don't have correct login credentials you get the same generic error as we've discussed. Please edit your answer mention this (if you want to , so the next guy won't overlook the answer in the comment). I've marked answer is accepted - thanks again!