I have VB.NET app that communicates with some external server (maintains login sessions via Intranet), and I want to listen for Sleep/Hibernate events such that when it happens,
try below:
To restart the pc
System.Diagnostics.Process.Start("Shutdown", " -r -t 00")
To shutdown the pc
System.Diagnostics.Process.Start("Shutdown", " -s -t 00")