Sign in to follow this  
Followers 0
steve8tch

Shutdown() - bug or feature

3 posts in this topic

I have just come across an interesting anomaly.

I created a service that checks whether a user is logged onto a computer

The service is set to run automatic.

On reboot, the service checks if anyone is logged on. If they are not logged on, I set up autologon, reboot the computer, and then the computer will reboot and be automatically logged on.

Why (you may ask) - these are all headless computers - I need them logged on to run certain applications. I cannot set up autologon permanently as these will leave admin passwords as clear text in registry.

The problem is this.

When the service is run in the context of a user (an admin), the shutdown command will not work.

As a test, I put timers in, logged on, and the shutdown functions will work fine - but only if someone is logged on

When the service is run in the system context either interacting with the desktop or not, shutdown works fine.

So to re-iterate. The function seems to stall

if run as service in a user context.

and No-one is logged on

Anyone any thoughts ?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

My thought is that I need to rewrite Shutdown() to suck less. The API we currently call can succeed without actually shutting the system down. In reality, it shuts down the session for the caller. For the interactive user it shuts the system down. For anybody else... not so much shut down.

That's a long winded way of saying "I know and I can change it". I've just created #839 to track that.

Edited by Valik
Missing words suck.

Share this post


Link to post
Share on other sites

Valik, Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0