It's my first time creating windows service, and I am trying to open an Executable File for currently Logged In User, while the service is running as Local Service, or Local System, but what I am encountering is that Executable runs as SYSTEM user but doesn't show it to the User by that I mean that the process is Running under SYSTEM user without showing a Window for the Logged In User.
If my windows service is running as Local Service, then it doesn't appear that Executable File is able to RUN. No signs of life in the Task Manager.
I have tried looking up my problem and tried these solutions:
- Process.Start("FileName");
- File.Open("FileName", FileMode.Open); Didn't do anything! (No signs of life in task manager)
- ProcessStartInfo("FileName") with Verb = "run as"; Didn't change anything (Running as SYSTEM)
- Tried shell command from Command Prompt: Process.Start("run as (Forgot the whole command line I typed)"); Didn't do anything! (No signs of life in task manager)
- ProcessStartInfo("FileName") with Username = "User" without Password; Didn't do anything! (No signs of life in task manager)
I do think that solution 4 and 5 didn't work because Password is required, but according to Microsoft Post about Local System it says that SYSTEM doesn't need a Password to access a User (Impersonation), but I dont understand what Impersonation really is, it seems to do something with Win API Natives.
What I think is that the Executable File Window is actually shown to the SYSTEM when Executable is running. Not to the currently logged in User.
Now:
- Is there a Solution to my problem without WinAPI Natives?
- If Natives are necessary, could you also try to explain it to me? When posting the code? I only understand Handles of WinAPI that's all I really do understand.
- Could this be possible on Local System running service? As my service is focused to do System Management? Instead of Local Service.
- Is it possible to do all of this in C# Programming Language?
PS: The project I am working on is a System Management Toolkit for my company. For future projects.
PS2: If you need any more Information tell me and I will check this post Frequently.
PS3: Sorry for my English, if you see any grammar mistakes.