Question

I'm building a Windows service that performs different actions based on which Windows user is logged in. If I install my service under one user, and set it to start-up, will a separate instance of it run for each user that logs in, continuing to run, even if more than one user is currently logged in?

This is the behavior I would like, but if it is not possible, I'll have to plan for something else.

And in general, is each user log-in session like its own, independent environment? In other words, if I have a driver installed that interacts with my service via named pipes, will the piped message sent from the currently logged in user's driver be also be received by the other service instances running in under other logged-in users (assuming they do run separate instances, as asked above)? Or are they completely separate environments with their own drivers/kernal instances?

Was it helpful?

Solution

At least as of XP, services could only have one instance. Of course, a privileged service could create processes as other users, but they wouldn't be, formally, services.

OTHER TIPS

As noted, a Windows service has one instance. By default it runs as the Local System account and not as any particular user (and it does not have access to individual users' environments etc.) It does not inherit anything from the currently logged-in user in terms of credentials. You can set specific user credentials for the service (through the service control manager, for example) to run the one instance of the service as any given user. But you only get one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top