Windows service works with other user than the admin

Joao Fernandes 21 Reputation points


I’m trying to configure a Windows service to open notepad. After searching on the Internet, I’ve found few solutions that works well in a specific case. The specific case is under the “admin” user the one configured during the windows installation.

I’ve added a new user in my system, with administrator rights, the service starts well, however they do not notepad. No error is generated on events and again no notepad open.

Do you have any idea about?

Thank you so much for your help!

Best regards

Joao Fernandes

A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
3,032 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 34,801 Reputation points

    Typically a Windows Service runs in a non-interactive session (session 0). And, unless specific steps are taken a process started by a Windows service will also run in session 0. Since session 0 is non-interactive no process started in it can display a user interface. So although a Windows Service could start notepad in session 0, notepad's user interface would not be displayed.

    Starting a process from a Windows Service in a logged-on user's interactive session so that a user interface is displayed requires the service to start the process with a token that contains the correct session id and also will have the necessary access permissions for the interactive session's window station/desktop. Accomplishing these objectives is not a trivial undertaking.

    Its not clear to me from your description of the problem what you are doing. And, since this seems to be a question about coding I suggest you also tag the question for the programming language that you are using.