© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
10 replies
medicooey

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.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Hangfire as windows service
C#CC# / help
2y ago
✅ Hosted Service running as Windows Service
C#CC# / help
2y ago
gRPC Windows Service
C#CC# / help
4mo ago