0

I need to (force) reboot Windows from inside a Windows Service written in C#. The ordinary way of doing it, from a desktop application, shutdown.exe, will probably not work at all? I assume I cannot run an EXE file from inside a service..

ingvarius
  • 13
  • 4
  • possible duplicate of [Reboot machine from a C#/WPF app](http://stackoverflow.com/questions/1215139/reboot-machine-from-a-c-wpf-app) – Michal Hosala Oct 15 '14 at 13:27

2 Answers2

1

Look at the Win32 API InitiateSystemShutdown() and/or InitiateSystemShutdownEx() function.

Also refer to this MSDN article: Shutting Down.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
0

I have tested it, but it does not work inside a Windows Service, it seems..

ingvarai
  • 21
  • 2