Click here to Skip to main content

Run an application under current logon user's privileges

Introduction

The task was to run an application in the current user's privileges even though it was scheduled as a system account. It required 1.5 days R&D to get a proper solution. I have provided 3 solutions to this.

Solution 1

The application must be run as a local system account (use AT command). This is the prerequisite for successful execution of APIs.

Take sessionId of the current session, then find the current user's token, then impersonate as logon user.

Solution 2

I have taken the token of explorer.exe and then impersonated as a logon user.

Solution 3

I have taken the token of logon user and then impersonated as a logon user.
Solution by: Nitin Lokhande


Web01 | 2.8.160204.4 | Advertise | Privacy
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service