If you’re connecting to SQL Server within a corporate environment, you might need to connect to SQL Server using a different Domain User account. This can be done by opening SQL Server Management Studio (SSMS) as a another user, which I’ll demo in this post.
Connecting to SQL Server with a a different Domain User is needed if your currently logged in user is not on the same Active Directory (AD) Domain as the SQL Server you want to connect to.
Topics Covered:
1. How to Open SSMS as Different User
2. Create PowerShell Script to Open SSMS as Another User
1. How to Open SSMS as Different User
This part shows you how to connect to SQL Server with a user that is not your currently logged in Domain User, using SQL Server Management Studio (SSMS).
Open SSMS as Different User:
– Locate the SSMS shortcut in the Start Menu or Taskbar.
– While holding the Shift Key, right-click the SSMS shortcut, and select Run as a different user.

Enter your Domain Credentials as prompted.
– For AD Domain User accounts you should be including the Domain prefix as shown below (pwlab\
).

Even though the connect to server window will still show your currently logged in Domain, SSMS will connect using the login details provied.

2. Create PowerShell Script to Open SSMS as Another User
Now that we know how to connect to SQL Server using a different Domain User account, we’ll now look at doing this using a PowerShell Script. This is useful if you need to do this often – creating this script and saving as a shortcut will save you from some of the steps above in this post.
We can open SSMS as different user by running the command below in a PowerShell Terminal:
# Open SSMS as another user # amend domain\username before running C:\Windows\System32\runas.exe /user:domain\username /netonly "C:\Program Files (x86)\Microsoft SQL Server Management Studio 19\Common7\IDE\Ssms.exe"

You can save this command by simply opening a new Notepad, copy/paste the command and save to your desktop as a .ps1 file. When you run the file you’ll be prompted to enter the password for the Domain User defined within the PowerShell script.
Note: The path used to call SQL Management Studio in this script is tailored to SSMS version 19. You should amend the path to reflect your current version.
Hope this guide was a useful one for you! Feel free to add a comment if there’s room for improvement here.
Leave a Reply