Open SSMS as a Different Domain User

🛠️Part of the SSMS Complete Guide, installing, configuring and fixing SQL Server Management Studio.Related pillar: Security

⚡Shift + right-click SSMS → Run as different user, or runas /netonly /user:DOMAIN\user “path\to\Ssms.exe”. Use /netonly when the account is in another domain or is not allowed to log on to this machine.

You need to connect to SQL Server as a different Windows account: to test a new AD login’s permissions, to reach an instance in another domain, or to check access without signing out of Windows.

SQL Server Management Studio (SSMS) cannot switch accounts inside the Connect to Server dialog, so you start SSMS itself as that account. There are 2 ways, and which one you need depends on whether the account can log on to your machine.


Open SSMS as a Different Domain User (GUI Method)

This is the quickest option when you only need to switch users occasionally.

To do this, start SSMS under the alternate domain account.

  1. Locate SQL Server Management Studio (SSMS) in the Start Menu or taskbar
  2. Hold Shift, then right-click the SSMS shortcut
  3. Select Run as different user
  4. Enter the credentials for the required domain account
Run SSMS as different user option in Windows

Enter the credentials for the Domain User in the prompt that follows:

Enter the credentials for the domain user

SSMS now really runs as that account, so the Connect to Server window shows it under Windows Authentication. The account needs permission to log on to this machine. If it is from another domain, or that logon is refused, use the command line method below instead.


Open SSMS as a Different Domain User (Command Line)

If you need to do this regularly, launching SSMS from the command line is faster and easier to repeat.

Run the command below, updating the domain, username, and SSMS path as required:

# Open SSMS as another domain user
# Amend domain\username, and point the path at your own SSMS install
C:\Windows\System32\runas.exe /user:domain\username /netonly "C:\Program Files\Microsoft SQL Server Management Studio 22\Release\Common7\IDE\Ssms.exe"

# SSMS 19 and earlier: under Program Files (x86), and no Release folder in the path
C:\Windows\System32\runas.exe /user:domain\username /netonly "C:\Program Files (x86)\Microsoft SQL Server Management Studio 19\Common7\IDE\Ssms.exe"

You will be prompted for the password, after which SSMS will start using the supplied domain credentials. The capture below was taken against an older SSMS layout, so the path in the frame is not the one above. The prompt and the launch behave the same way whichever version you point at.

Run SSMS as different user using runas command

The /netonly switch means only network authentication uses the alternate account: SSMS itself still runs as you. That is why the Connect to Server window keeps showing your own Windows login under Windows Authentication. Ignore it, because the connection to SQL Server is made with the account you gave runas. It also works for an account from another domain that could never log on to this machine. One catch: runas /netonly does not check the password when it starts SSMS, so a mistyped password only shows up as a login failure when you connect.

SSMS Connect to Server window after runas /netonly: Windows Authentication still shows the local user PETE-PC\pete, marked Ignore

If this is something you do often, saving the command as a shortcut or small PowerShell script removes the friction entirely.


Finding the SSMS Executable Path (SSMS 21 and Later)

The first example path above is where SSMS 22 installs by default. From SSMS 21 onwards, SQL Server Management Studio is installed and managed via the Visual Studio Installer, which means the installation location is no longer fixed.

As a result, Ssms.exe may be installed in a different location depending on the SSMS version and how it was installed.

The quickest way is to ask Windows rather than open anything. This returns every Ssms.exe on the machine, whichever version installed it and wherever the installer put it:

Get-ChildItem 'C:\Program Files*\Microsoft SQL Server Management Studio *' -Recurse -Filter Ssms.exe -ErrorAction SilentlyContinue |
    Select-Object -ExpandProperty FullName

On a machine with SSMS 22 that returns C:\Program Files\Microsoft SQL Server Management Studio 22\Release\Common7\IDE\Ssms.exe, which is the string to paste into the runas command. If several versions are installed you get a line each, so you can pick the one you meant.

Or find it through the installer:

  1. Open Visual Studio Installer
  2. Locate SQL Server Management Studio
  3. Select Modify
  4. Note the installation location shown at the bottom of the window
Visual Studio Installer showing SQL Server Management Studio install location

The SSMS executable (Ssms.exe) will be located in this directory shown above.

Example runas command using SSMS 22:

C:\Windows\System32\runas.exe /user:domain\username /netonly "C:\Program Files\Microsoft SQL Server Management Studio 22\Release\Common7\IDE\Ssms.exe"
Running SSMS 22 as a different domain user from the command line

If you need to confirm which version of SSMS is installed, how it was installed, or where it lives on disk, see Install and Update SQL Server Management Studio (SSMS)


Frequently Asked Questions

How do I check which account SQL Server actually sees?

Connect, then run SELECT SUSER_SNAME() AS login_name, ORIGINAL_LOGIN() AS original_login; in a query window. After runas /netonly it returns the domain account you gave runas, even though the Connect to Server window showed your own.

My laptop is not on the domain and I get error 18452. Does runas help?

Yes, that is the case /netonly is for. The local account means nothing to the server’s domain, which is why it answers with the login is from an untrusted domain (18452). Started with runas /netonly, SSMS presents the domain account over the network instead.

Does the same trick work for sqlcmd or PowerShell?

Yes. Start the shell itself with runas /netonly /user:DOMAIN\username powershell.exe, and anything in that window that uses Windows Authentication, sqlcmd -E or Invoke-Sqlcmd, connects to SQL Server as that account.


Summary

SSMS does not support switching users inside the application, but Windows does.

Launching SSMS as a different domain user is typically required when testing SQL Server permissions, validating Active Directory group membership, working across domains, or troubleshooting authentication issues where your Windows login does not match the SQL Server domain.

For one-off access, Run as different user is the quickest option.
For repeatable workflows, using runas provides a simple and predictable approach.

Both methods are supported and commonly used in real production environments.


Where To Go Next

More in this series: Install and Update SQL Server Management Studio (SSMS) · DBA Scripts: Install and Update SSMS via PowerShell · DBA Scripts: Uninstall SSMS via PowerShell

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *