Select Page

On my current contract, I have to develop and support SSIS packages for multiple versions of SQL server and in order to work with multiple versions, I am running a virtual machine.

The problem with virtual machines they are not connected to the active directory, and in most cases, I need to connect to SQL Server using Management Studio using Windows Authentication.

Usually in the past, when I need to run the application under a different account, I used the ShellRunAs application from Sysinternals, it creates a nice context menu that allows to type credentials for the different users, but in this case, it did not work, because I was running it from the virtual machine. It complained that “The username or password is incorrect”.

The solution for this issue is to provide an additional parameter to ShellRunAs application /netonly – Use if specified credentials are for remote access only

The problem ShellRunAs accept this parameter when it runs from the command line and there is no UI to run the application with that command. But this can be fixed by creating another context menu item that will have such a parameter.

ShellRunAs is registered for multiple file formats under the Shell key in the Windows registry. For example, for *.exe files, it registered at HKEY_CLASSES_ROOT\SystemFileAssociations\.exe\Shell\

it also registers for link files and msc files (Microsoft management console)

I created a Windows Registry file for register shellrunas in the context menu and unregister shellrunas from the context menu

The registry files need to be modified for your system to use the correct location where ShellRunAs.exe file is located. In my case it’s c:\Sysinternals\ShellRunas.exe

Now, after I have executed registry files, I can see another context menu

Executing Microsoft SQL Management studio under domain account from non-domain computer

If you like the command prompt, the same can be achieved using the RunAs command, it does not have GUI but works absolutely the same (you can use both Powershell and Cmd). On the sample below I am running Microsoft Management Studio from a machine not connected to the domain

 PS C:\> runas /netonly 
"C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Ssms.exe" 

Enter the password for Attempting to start 
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Ssms.exe 
as user "" ...    

As a result after my SQL Management studio starts I am able to access all databases under my domain account and SQL Management studio is actually running under my domain account