Using runas command to remotely logging into SQL Server
I can't comment so I will give new answer. To use shortcut with server name
%windir%\System32\runas.exe /netonly /user:domain\username "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Ssms.exe -S SERVERNAME"
You first need to add server name and server IP to Your host file:
C:\Windows\System32\drivers\etc\hosts
Without it You need to use server IP:
%windir%\System32\runas.exe /netonly /user:domain\username "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Ssms.exe -S SERVER_IP"
For example You want to connect to server 10.10.10.123 using name MSSQLSERVER01 in domain MASTER using account name STACKUSER2019. So You add this line to host file:
10.10.10.123 MSSQLSERVER01
and after it run from CMD or from shortcut:
%windir%\System32\runas.exe /netonly /user:MASTER\STACKUSER2019 "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Ssms.exe -S MSSQLSERVER01"
I use the following on a shortcut to run SSMS on an xp image that is NOT on the domain to connect to a server using domain credentials.
%windir%\System32\runas.exe /netonly /user:domain\username "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe -S SERVERNAME"
That is correct, /netonly will open your current environment, and SSMS will foolishly display your credentials in the login dialogs. This is to be expected, since /netonly really means that the provided identity will be used only on the net. However, when you authenticate with any remote resource the remote site will authenticate you as 'domain\username'.
You probably don't need the /server option.