Change Power & Sleep Setting Programmatically

Mujahid Desai 41 Reputation points
2021-11-24T05:08:18.197+00:00

I want to update Power & Sleep Setting Programmatically

152053-power-setting.png

I have tried PowerWritePossibleValue API (ref: nf-powrprof-powerwritepossiblevalue) but there is no proper documentation or sample available.

**Is there any way to update the power and sleep setting programmatically? Through .Net/C++ **

Windows development Windows API - Win32
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 90,521 Reputation points
    2021-11-24T08:47:49.14+00:00

1 additional answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 12,731 Reputation points Microsoft External Staff
    2021-11-24T06:56:55.183+00:00

    According to the Answer which supplies multiple solutions, The easiest way would be to use the Powercfg utility. WMI ,Power Management Functions and Registry also work.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.