Sql Server Management Studio : How to Logon with different windows username???

  • Hi

    How can I use Sql Server Management Studio to 'Connect' to a server using a different domain account?

    I don't want it to use the logged in account, I want to be able to specify a different domain\username and password.

    Any ideas?

    I know I can create an admin Sql Server account but for this scenario I want to use another domain account.

    Please help / advise

    Thanks

  • Ian,

    even though you can type another windows name in the connection window, there are a couple of ways to do this.

    1) Start SSMS with the "Run as" option.

    2) In a Query Window use the "Execute AS LOGIN" command before executing a query.

    The second option is especially usefull if you want to switch between users, while the first one offers the advantage that you can use Object Browser connections as well.

    Markus

     

    [font="Verdana"]Markus Bohse[/font]

  • Sorry this should be

    "Even though you can't type another windows name".

    Markus

    [font="Verdana"]Markus Bohse[/font]

  • Hi

    I can use things like remote desktop to log on to the server, and open ssms within the remote server! BUT I cannot locally open ssms.

    RunAs does not work since I'm running this inside a Virtual PC Which is not like a PC on the domain using shared networking.

    I can however (as mentioned in first paragraph)

    1. I can remote desktop to servers on the domain and then enter my domain username + password (from within the virtual pc!!!)

    2. I can view the internet after typing in the proxy settings and providing my domain username + password (from within the virtual pc!!!)

    3. I can view file shares that I have access to after providing my domain username + password (from within the virtual pc!!!)

    BUT I cannot use SSMS within the virtual pc!!! darn!

    Let me know if this information helps, and if you know of a way I can use SSMS in this scenario.

    Thanks

  • You won't be able to use Window Authentication in SSMS from within a Virtual PC unless it's joined to the domain. Your only other option is to use SQL authentication.

    --------------------
    Colt 45 - the original point and click interface

  • If you connect to the server or map a drive with the credentials you want to use first then those are the credentials that will be used for windows authentication with SQL server.

    steps:

    Disconnect all network connections to the server -

    Open a command prompt (start-> run->enter "cmd")

    type: "net use \\[servername]"

    if you see any connections to the server, you must disconnect each one first with "net use /d \\[servername]\sharename"

    now run:

    net use \\[servername] /user[domain\[username]

    you'll be prompted for your password. enter it. if you get a message about not being able to connect with different credentials, you didn't disconnect all other connections first.

    Now just run SSMS as usual, and connect with windows auth. This works even if the machine you are connecting with isn't on the domain.

    The same trick works with outlook/exchange. Its very handy

  • You can map a drive to the virtual pc using one of the accounts on the vitual pc and specify the machine name instead of the domain name -for example, if the VPC hostname is "vm01" map a drive as "vm01\administrator" and enter the admin password when prompted.

    Then run SSMS on your pc, point it at the VPC with windows auth.

  • Hi John

    I have tried your suggestion with net use, by first disconnecting the server and then running net use with my domain account, which worked after i entered my password.

    But when I open ssms it still gives me this error message.

     

    Login failed for user ''. The user is not associated with a trusted SQL Server connection.

  • Hi Ian,

    If you are trying to connect to SQL server on your virtual machine which isn't on the domain then you should connect using an account from the virtual machine, not your domain account.

  • From my experience, if the computer running Management Studio isn't in the same domain (or trusted domain) as the SQL server, you can't use Windows Authentication to connect to the SQL server.  

    The trick of mapping a drive to the SQL Server will work for other things that use windows authentication (such as computer management, SQL 2000 Enterprise Manager / Query Analyzer) just won't work with Management Studio.

    One technique I haven't tried (and I could see the strange MS logic in using this) is to put an entry for the SQL server in the control panel, user accounts.  If this doesn't work, you will have to use a SQL Account.

    Personally, I believe this is a design flaw.  In my environment, I constantly have consultants, vendors, etc. working on specific pieces of equipment.  By that definition, their laptops aren't in my domain and they can't use windows authentication from them.

  • Ahh... now you mention it, I'm not sure I have actually tried this with sql2005/SSMS. At my last job I used this method... but it was sql2k.

    So sorry Ian, you might be out of luck.

  • I connect cross domain with SSMS -- but I have to set up an alias in my SQL Server client configuration.

    You can try this:

    Follow John's steps to issue the net use command.

    Open SQL Server Client Network Utility (start-> run->enter "cliconfg")

    1. enable Named Pipes protocol (and move to top in the order)

    2. under the Alias tab, add a new alias with:

      a. "Named Pipes" selected under Network Libraries

      b. enter [servername], for servername (you should see something like "\\[servername]\pipe\sql\query" in the pipe field)

    What I haven't figured out is if the order (net use vs. cliconfg) matters. sometimes i've had to delete the connection and the alias and start all over before

    I get a good connection).

    good luck,

     

  • The following also works, although you must manually enter the password:

    runas /netonly /user:remotedomain.com\username "Ssms.exe -S sqlserver.remotedomain.com -E -nosplash"

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply