I want to turn on the PC from sleep mode on windows 10/11 programmatically in WPF (.net framework) C# application. How to achieve it ?

Vishal2 Bansal 85 Reputation points
2024-02-01T07:10:15.0166667+00:00

I want to perform windows sleep turn on and then wake up the PC after some time say 2 days later.

I have two options :-

  1. Either programmatically sleep the pc and wake it up later automatically(but it requires manual entering of password to pc after wake up).
  2. Only Turn off the display: using below article https://stackoverflow.com/questions/713498/turn-on-off-monitor But then my monitor is turning on for a blink of 1 sec only and again turning off.
  3. Using Wake on Lan to turnon the display(I haven't implemented it yet). Want to know it's effectiveness for windows 10/11.

My preference is option 2,3. So can just me the way to overcome it and provide me the solution for same.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,565 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,705 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,561 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
781 questions
{count} votes