Saturday, October 21, 2023

Running Windows Applications as a Different User using System Internals ShellRunas

Using the runas command from a Windows console windows was demonstrated in the post,  Access SQL Server Management Studio using a different Active Directory Credential. The concept was that a user was logged in to Windows and an application (SQL Server Management Studio e.g. ssms.exe) needed to be run as a different user (hence the use of runas).

The much vaunted Windows Sysinternals was acquired by Microsoft in 2006 and among the useful utilities produced by Sysinternals is ShellRunas. As the previous documentation link shows:

Install ShellRunas Shell Extension

ShellRunas can be downloaded and zipped from Download ShellRunas. The download, contains an executable ShellRunas.exe. To install ShellRunas as as a Windows shell extension, run the following from a Windows console terminal in the folder containing ShellRunas.exe:

.\ShellRunas.exe /reg

Invoking ShellRunas as shown above displays a dialog indicating the shell extension has been added;

Running ShellRunas from Explorer

To demonstrated on Windows 11 how to use ShellRunas navigate in Windows Explorer to the folder of the application (such as ssms.exe): 

C:\Program Files (x86)\Microsoft SQL Server Management Studio 19\Common7\IDE

From Windows Explorer right click on the application (such as ssms.exe) which displays a context menu such as the following:

The bottom option of the context menu is "Show more options." Select this menu item which displays the following context, sub menu:

From the above context menu select "Run as different user" which display the following dialog courtesy of Sysinternals ShellRunas:

The above dialog can be used run an application as a user that differs from the currently logged in Windows user.

Why Such Complicated Navigation?

ShellRunas dates back to February 26, 2008 and the era of WidnowsVista, Windows Server 2008, and President George Bush.  The example shell context menu shown at the top of this post is from Microsoft's ShellRunas documentation and is as follows:

The above context menu dialog box were displayed when right click on an executable that was run on Windows days of yore sometime a.k.a. some version before Windows 11.

ShellRunas used to be convenient. As of modern versions of Windows, ShellRunas is a handy utility with navigation that is a bit too complex.


No comments :

Post a Comment