Opening SQL Server Management Studio as different user automatically with run or runas commands

hpxqektj  于 2023-10-15  发布在  SQL Server
关注(0)|答案(2)|浏览(103)

I am trying open SQL Server Management Studio as different user than that I am logged in as in the below command but SQL Server Management Studio is opening but not as the User DevAdminAm, it is just opening like my login user not as different user

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

Can anybody please help me why is it not opening when I save it as batch file and double click it or when I run it as windows command in the startup.

When I run it in startup, it opens SSMS but not as different user as I am intending, any help please.

i5desfxk

i5desfxk1#

I got it. Try to set in your credentials manager with these credentials:

  • Server:servername.tld:1433
  • User:domain\account
  • Password: Password of the user domain\account
3vpjnl9f

3vpjnl9f2#

The UI will show you your currently logged in local user, e.g. in the connection dialog and Object Explorer, but when you are connected to the server and run SELECT SUSER_SNAME(); , it will show your specified domain account.

See the explanation about that here and also mentioned several places here, e.g. this answer .

相关问题