GetSystemPowerStatus

[DllImport("Kernel32.dll")][return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetSystemPowerStatus(
   out SYSTEM_POWER_STATUS lpSystemPowerStatus
);

Microsoft documentation: Link

Last updated