KB: How to connect to a server with a different Windows account?

To connect to a server with a different Windows account:

The free tools need to be run using a Windows account that has sufficient privileges to connect to the relevant server(s). To connect to a server with a different Windows account than the Windows account that is logged into the client machine: 

  • The user account needs to have Administrator privileges on the client machine.
  • The user account needs to have sufficient privileges to connect to the relevant server(s).

using Run as different user (same domain):

  1. Press the Shift key while right-clicking on the (shortcut to the) relevant executable. This may not work in the “Start” menu
  2. From the pop-up menu, select “Run as different user”
  3. In the “Windows Security” dialog, enter the credentials to use for the selected executable.
    The user credentials need to belong to the same domain as that of the already logged-in account

using runas command (different domain): 

  1. Select “Windows Desktop > Start”.
  2. In the “Start” menu, type “cmd.exe” or “Command Prompt”, and select the “Command Prompt” entry.
  3. In the “Command Prompt” window, enter:
    runas /netonly /user:domain\user “{path to executable}”

For example:

runas /netonly /user:myDomain\myUserName “C:\Program Files\Idera\SQL Check\Idera.SQL.Check.exe”

or

runas /netonly /user:myDomain\myUserName “%Program Files%\Idera\SQL Check\Idera.SQL.Check.exe”

The user credentials can belong to a different domain than that of the already logged-in account.

using Microsoft Windows Sysinternals ShellRunas

A popular graphical user interface for the "runas" command is Microsoft Windows Sysinternals ShellRunas.

using Control Panel's Credential Manager

  1. Open Windows Control Panel.
  2. Open Credential Manager.
  3. Select "Windows Credentials".
  4. Select "Add a Windows credential".
  5. In the "Internet or network address" text box, enter the name and port number of the SQL Server instance.
    For example, "mySQLServerInstance:1433".
  6. In the "User name" text box, enter the username including the domain.
    For example, "myDomain\myUserName".
  7. In the "Password" text box, enter the valid password.
  8. Select the "OK" button.

Refer also to Microsoft TechNet documentation Runas.