Search code examples
c#windows-10uacelevated-privilegessession-0-isolation

How to start an application elevated on account without admin privileges on Windows 10


I need to start an application elevated on a user account without admin privileges. I am using Windows 10. The station will have two user accounts: admin and operator. All applications will be installed using the admin account (off course with admin rights). After that the user will be using the operator account.

I need the applications to run with elevated rights but without the UAC prompt.

I tried the following approaches:

  • Using a windows service to run the apps. This poses a problem as the apps have a GUI and I cannot find a workaround for session 0 isolation.
  • Using Task Scheduler to run the application. This also failed as the apps were started without GUI.
  • Using runas. Also failed as I was faced with dealing with password and UAC prompt and some 'access denied' problems.

I am aware that some of the above methods may be regarded as bad practices. I am aware of potential risks. Also, my applications run on a dedicated machine in kiosk mode where the end user cannot interact with the OS.

Any help or hints (also regarding my failed approached) welcome!


Solution

  • It took a lot of reading, research and trial and error. However, I managed to stumble upon this repo which solves everything:

    https://github.com/perspectivism/subverting-vista-uac

    The code inside demonstrates how to start any application from a windows service and display the GUI in a given user's session.