Windows service works with other user than the admin

Joao Fernandes 41 Reputation points
2023-09-04T14:18:26.67+00:00

Hi

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

Windows
Windows
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.
5,582 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 45,866 Reputation points
    2023-09-04T14:40:38.64+00:00

    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.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.