Have you ever required to open SQL Server Management Studio Application (SSMS instance) as different windows user from your local machine? Sometimes we require to “Run SSMS instance as different Windows user” another machine which is not available physically to us. In such type of scenarios we can open our local SSMS instance as different windows user at our local machine. In this article we are going to learn how we can open SSMS instance as different windows user. If you are still not required this till now, may be sometime in future you will be required to do the same.
Now to accomplish this task i.e. to open SSMS as a different windows user, we have below approaches;
- Using Run as different user option in windows explorer
- Using runas command in command prompt
- Using runas command with “.bat” file
We will cover all the above techniques below.
1. Using Run as different user option in windows explorer
This method is easiest one to to run as different user. Follow below steps to start it with different windows user than logged in windows user;
- Go to the location of SSMS.exe or it’s shortcut, in my case SSMS.exe is located at “C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio” location. You can also go to Start -> Programs -> Microsoft SQL Server (Your installed version).
- Press “Shift” key, by holding this, right click with your mouse over SSMS.exe.
- You will get the below pop up window.
- Select “Run as different user” from above pop up menu.
- You will get a “Windows Security” dialog box as below where you can put the desired windows user name and password to run the SSMS instance. In case you want to change the domain also put user name as “domain\username”. To start with different domain, the entered user name should also has an account on that domain.
- If your entered credentials are authorized, SSMS instance will be opened and you can see that in “Connect to server” dialog box, the user name is as entered in “Windows security” dialog box, which ensures you are running this instance as this user.
So now you have started the SSMS.exe as different windows user. Now we will proceed with another method “Using Run as command in command prompt”.
2. Using runas command in command prompt
We can also use “runas” Command at command prompt with /netonly switch to execute the SSMS.exe as a different windows user. With /netonly switch we can log in using remote credentials on given domain even you are not a member of.
To do this follow these steps;
- Open Command Prompt.
- Copy and Edit below command as per your environment and then paste it to command prompt and press enter key.
- runas /netonly /user:MyDomain\MyWinDowsUser “C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Ssms.exe”
- When you will press Enter key, you will be asked for the password, enter your windows password and press enter key. Remember that you have entered windows password.
- A new instance of SSMS will start with given windows credentials and it can be verified from “Connect to Server” dialog box in User name box as we did in previous method.
3. Using runas command with “.bat” file
If you have to open SSMS instance again and again with a given credential, we have another better method. Follow these steps;
- Just copy the above runas command, edit it as per your environment.
- Open an instance of notepad and paste it into this.
- Press “Ctrl + S” or choose “Save” from “File” menu.
- “Save As” dialog will appear.
- Change “Save as type” to “All Files” and type a name followed with a “.bat” extension, choose your location and click “Save”.
- Go to the location where you have saved the above “.bat” file, you will get a file as below.
- Make a Right click on the above file and “Open” or “Run as administrator”. Command prompt window will appear and you will be asked for windows password of the given Domain\Username.
- Enter password and press enter key. SSMS instance will open with the credentials as saved in “.bat” file.
Now i have done what i have promised at very beginning of this article. If you have enjoyed this post and really want to appreciate my effort, kindly do share and rate this post. Please don’t forget to put your valuable comments and suggestions in comment section of this post.
Thanks for your patience for reading this post.
I am trying the third method. Using .bat file. When I run as Administrator, I am unable to type in the password in command prompt? All the keys in keyboard except Enter key are not working.