Creating Process as User from a Windows Service
I have a windows service that is meant to locate an active windows user token and run a process in their userspace. This seemed an easier path than doing something like named pipes; I want a service that executes a WPF app in the user session to prompt them to take action. Running into issues with my service though - when the service attempts to run a process as the user, I'm getting errors:
System.ArgumentNullException: SafeHandle cannot be null.Happy to share the code, but just as happy to abandon this method and consider another. Challenge is we will never know the exact user we need to run this on; we want to be able to dpeloy this to any computer and have it function without knowing the users on the device. Task scheduler appears to be another mechanism, but I've not had luck figuring out how to get that to run in the user's space without knowing who the user is on any given device.
4 Replies
.v nvgg . '' '
/'/ // v., c.v .,,,, .c
/6* g,c;.b vh ;/;';
are you okay?
There is some sort of stuff you can inject into the setup of a new user, which allows you to add some sort of service that can handle your logic, to be run in user space
Also i believe you can set up the scheduler to run as the currently logged user?!
Unfortunately i do not have solid docs for either of these. I'm not so into admin stuff
Lmao my toddler was in here keyboard slapping
Are any of us ever really okay?
I'm going to try and spend some time with the task scheduler option. Think I was being ambitious thinking to do the windows service option- pretty new to all this and wanted to try something harder. Ending up over relying on gpt for the service stuff, so not able to troubleshoot effectively since I understand about half the code