Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
If there are multiple users in a system then for each user windows service can be separately started? Is this Possible?
Posted
Comments
Sergey Alexandrovich Kryukov 30-Mar-14 1:50am    
Why?
—SA

No. Services run under their own account and start before any user ever logs in.

Also, Windows can have multiple people logged in that same time, so it's kind of a very screwy requirement to have a service impersonate whoever is logged in at the "console".

You requirement doesn't describe a service, but an application that launches out of the Registry Run key when a user logs in.
 
Share this answer
 
No, this is against the whole idea of the service. A Windows Service is an application which can work independently of the users. It works without any desktop, will continue to execute when all users log off, and, if it is configured for auto-start, it happens before any users log on.

At the same time, a Windows Server is related to some account. Its behavior (permissions granted to the application) depends on the user account attributed to the service installation. Usually, this is one of the "special" account (most typically "Network Service", "Local System" or "Local Service"), but it can also log as a regular interactive user, and, in that case, it should be given a password of the user. Using an account of some interactive user for a service logon in not a desirable practice.

And of course, a service can detect different system events, such as user login and log off, communicate with the current user through some interactive application, and the like. It would not be a typical or intended behavior; and I don't think this is related to your question. It is not clear why are you interested in such a weird thing. It is possible that you could get some useful practical advice if you explained your ultimate goals.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900