locked
Starting app through windows service when logged out (Win 10) RRS feed

  • Question

  • Hello all,

    I am writing a windows service in C#. This service  starts a third party application at a certain time overnight. This app must run whether or not a user is logged on. I have created a dedicated user account that I want to run the app with. I have not been able to get the app to execute as that different user through a service. The app that runs is not necessarily interactive but it does normally have a ui that appears when it runs.

    I have read much about having to get a window station and a desktop object so that the app can run, but it makes no sense to me. Can anyone direct me to some GOOD documentation of how I might do this? Below is what I have tried so far:

    1. Use the logonuser function to get the dedicated user token
    2. Call SetTokenInformation with the token from step 1
    3. Call CreateProcessAsUser using the token

    Allen Thurman

    Saturday, December 16, 2017 4:34 PM

Answers