question

amomen avatar image
0 Votes"
amomen asked amomen answered

runas command malfunction

Hello everybody!

I am trying to use "runas" command to launch ssms.exe by another user using the following command:

 runas /noprofile /env /user:user /savecred "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe"

The message that the command shell returns is the following:

Attempting to start C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe as user "My-PC\user" ...

and then nothing happens, i.e. the program will not start up. I look up in the task manager and the process ssms.exe shows up for a very short time (few milliseconds) and then exits immediately automatically. I also have removed the /savecred and /noprofile switches, and tried the following commands too, but I can't achieve the aim that I need:

 runas /noprofile /env /user:user /savecred "\"C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe\""

output:

Attempting to start "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe" as user "My-PC\user" ...

 runas /noprofile /env /user:user /savecred "cmd /C \"C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe\""
 runas /noprofile /env /user:user /savecred "cmd /K \"C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe\""

but again, nothing happens. I appreciate your help so much

Regards,
Ali

windows-10-general
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Are you able to logon to the desktop with that account and run the program?

Do you get a UAC prompt when you do that?

0 Votes 0 ·

Yes I am able and I don't get a UAC prompt.

0 Votes 0 ·
amomen avatar image
0 Votes"
amomen answered

It turns out, that it has most likely something to do with SQL Server Management Studio version 18. Because I installed version 17 and tested it on another program too, and it worked out just fine.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SimpleSamples avatar image
0 Votes"
SimpleSamples answered amomen commented

Based on my research, you might need to use the format /user:domain\user instead of /user:user.

You can execute SSMS by holding the shift key then clicking on the ssms.exe and then selecting Run as different user. It is possible however to create a shortcut or command script (bat file) that executes SSMS using a command such as you have. See the following.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you so much :). But none of the above worked. It turns out, that it has most likely something to do with SQL Server Management Studio version 18. Because I installed version 17 and it worked out just fine.

0 Votes 0 ·