I need to shut down from my WPF application, and ensure the machine enters the same power state as using the traditional windows shutdown dialog.
I can shutdown to an unknown power state by using the following:
Process.Start("shutdown", "/s /t 0");
The problem is that using this shutdown process, when booting back up by pressing the power button, the psu draws less than 100 milliamps (usually between 80 and 85), as opposed to the ~300 milliamps drawn after using the dialog to shutdown.
Using the Shutdown dialog to shutdown, by default in windows 8, according the the System Power States enumeration is S4.
I would like to shutdown to that same S4 state, without forcing the user to make additional actions, clicking "ok" to shutdown on the dialog, etc.
Note:
I can call the dialog, by running the following VBScript, but would prefer not to take this route:
Call
Process.Start(@"C:\PathToScript\Shutdown.vbs");
VB Script
dim objShell
set objShell = CreateObject("shell.application")
objshell.ShutdownWindows
set objShell = nothing