I recently fixed a bug at work where one of our applications could not shutdown the computer it was running on when the user logged out. It turned out the problem was introduced when we recently modified the software to run under a non-administrator account. We had made the system more secure, but the program no longer had sufficient privileges to shutdown the computer. The fix for this was to have the software invoke the shutdown program using an administrator account. Since the solution might be useful to someone else, I’m posting the code that I implemented.
Code appears after the break…
Read more

