

= false Īny insights would be highly appreciated.Īfter some trial and error coding for a day now, I've managed to debug and figure out what was causing errors in solution with using pInvoke to CreateProcessAsUser() method in advapi32.dll module.Īs stated in the question itself, theres a topic on how to invoke GUI process from session 0 to current's user session using CreateProcessAsUser() method. Process.StartInfo = new ProcessStartInfo(processName, command) Most importantly, or most wondering question though: What does the command line / batch do that makes it work? Is it possible to program it's behaviour / solution in a helper app, or better yet, directly in the service itself?Īlso, when wanting to have a service handle GUI application, and where relying on Startup/Autorun is not desirable, what would be the better solution?Īppendix B: public static void ElevatedExecute(string processName, string command, bool useAdminElevationRights = false)
#Win 7 servetome show ui full
NET app was ran using Administrator account with full rights when it reported Access denied exceptions, and works totaly fine even under User account (restricted) if executed manually form folder, so there's really nothing special about it that would seem like a cause of the errors when ran from service. Now what bugs me the most is - Is there something I haven't found or try yet? Did I miss something important? The. To my surprise, this approach worked! The actual app started as if started regularly by executing the file manually. Note that it points to the shortcut, as calling exe directly does not work. The fourth try, solution included a batch file, that included a single command: Since command line worked, I went down that rabbit hole: Oddly enough, opening up Notepad.exe, cmd.exe, calc.exe using CreateProcessAsUser works just fine. Testing this using Local System account and CreateProcessAsUser, then calling approach B in the helper app, resulted in the same behaviour as in first test, where service invoked actual app. Third try, solution included helper application that service would call, which then starts up the actual app. There was no GUI present, as expected in a way. Under Administrator account, the solution using CreateProcessAsUser does not work as mentioned, but using approach B (code at the end of post), which works fine for one app starting another app, did not work.

While actual app starts up in GUI under user account, it either doesnt start (AIR), or it has issues and erros, mostly with Access Denied exceptions present (.NET app). Under Local System account, it works as expected, and I've successfully executed CreateProcessAsUser" command as shown here by murrayu and used his helper class implementation, but with no success.

Running a service under Administrator account -> This approach does not allow use of CreateProcessAsUser since its already in user session.Running a service under Local System account (with and without "Interact with desktop" option.).I've successfully set up a test service and have done tests with two accounts: NET exe, and second Adobe AIR build exe app. I'll be using words "actual app" which represents two GUI applications that I've tried to run. There are several posts like this describing why this has been removed and protected, and I understand session 0 isolation, but before any debate dives into why this shouldn't be done, I'm just trying to get my head around it, as I don't like the current solution that our company is using.
#Win 7 servetome show ui windows 7
NET) from a service application on Windows 7 Embedded (POS ready), and have come across several solutions, but none of them worked, with one exception I discovered along the way: Using a batch file as a helper file. I'm trying to solve an issue of starting up GUI application (Windows Forms. Note: Despite appearing as yet another question of the same matter, it's not, but choosing the right title seems hard so more appropriate title change is welcome.
