[QUESTION] How to reboot the system when computer is locked? #89680
Unanswered
ComptonAlvaro
asked this question in
Q&A
Replies: 1 comment
-
... why are you writing an application to do this? There are built-in commands to remotely restart Windows. Besides that, assuming you're running a reasonable management package you should be able to reboot machines via its interface as well. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a service that is hosted in a console application. I can send a request to this service to reboot the computer.
The computer has a normal user (no administrator), that log on when computer starts, and start this console application.
When I send the request to reboot the computer, it works if the user is log in, but is doesn't work when the session is locked. Normally the system lock the session when I connect through remote desktop, that when I close it, the computer passes to lock state, it doesn't keep the session opened.
I describe this to have an idea of the system, but in sumary, all works except when I send the request when the session is locked.
I have tried to shutdown the computer in two ways. The first one, is using the shutdown command, starting a new process. This is the code:
But I have read that this command it is not enough, that I should to use ExitWindowsEx. So I have tried this xample code:
And I call in this way:
ExitWindowsExHelper.ExitWindows(ExitWindows.ForceReboot, ShutdownReason.MajorSystem, true);
But it doesn't work too. I have the same behavior, I can reboot when the session is open but I can't when it is locked.
So i summary, I would like to know if there is some way to reboot the computer when the computer is locked, in the log in screen.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions