If you’re working with SQL Server in a corporate environment, you might need to connect to the server using a different Domain User account, opening SQL Server Management Studio (SSMS) as a another user.
This may be required if your computer is joined to a different Domain than the SQL Server you’re connecting to. Or, as a DBA, you might be testing the access and verifying permissions of a newly created SQL AD User.
In this blog post we will cover how to open SSMS as another user by command (saving as a shortcut), and via the Windows GUI.
Open SSMS as Another User with a PowerShell Script
We can open SSMS as another user by running the command below in your PowerShell Terminal. You should amend the Domain and Username before running this.
C:\Windows\System32\runas.exe /user:domain\username /netonly "C:\Program Files (x86)\Microsoft SQL Server Management Studio 19\Common7\IDE\Ssms.exe"
The above command can be saved to a shortcut file, so you don’t need to do the GUI way.
Open SSMS as Another Domain User
1. Find the SQL Server Management Studio (SSMS) application icon by searching for it using the Windows button, then:
> Right-click the SSMS app icon
> Hold down the CTRL key
> Select “Run As Different User.“
2. Enter the credentials for the desired Domain User in the prompt
This will open SSMS using the login you entered above. Even though the connection window will show an incorrect Domain, SSMS will connect with the desired AD User account.
Leave a Reply