Can I create local interactive windows user session programmatically

538 Views Asked by At

I have a windows service that runs under LocalSystem account to manage below scenario

  1. I dont want to share account password with users.

  2. I have username and password of the domain user that should logged in to machine.

  3. Autologon not suitable. Because, when a user locks workstation or logs off from account, it will ask for credentials. Users will not have account password.

  4. I tried credential provider, It can auto unlock or logon to computer with credentials but, its not useful in my case (Hard to implement, manage and register)

  5. I tried this solution, but it doesn't create local session.

  6. I tried LogonUser api, i can authenticate user and get token but no session.

What i can do;

  1. I can switch to another session with / without password with WTSConnectSession.

I need to create a local session with a domain user that i have credentials. Like below;

Task Manager Users

1

There are 1 best solutions below

0
candogg On BEST ANSWER

I implemented credential provider. I used https://github.com/phaetto/windows-credentials-provider as base.