diff --git a/LenovoLegionToolkit.Lib/Utils/Power.cs b/LenovoLegionToolkit.Lib/Utils/Power.cs index 8c71ced0b4..894d11bf09 100644 --- a/LenovoLegionToolkit.Lib/Utils/Power.cs +++ b/LenovoLegionToolkit.Lib/Utils/Power.cs @@ -11,6 +11,16 @@ public class PowerPlan public string Name { get; } public bool IsActive { get; } + public string Guid + { + get + { + var guid = InstanceID.Split("\\").Last(); + guid = guid.Replace("{", "").Replace("}", ""); + return guid; + } + } + public PowerPlan(string instanceID, string name, bool isActive) { InstanceID = instanceID; @@ -41,11 +51,7 @@ public static void ActivatePowerPlan(PowerModeState powerModeState) if (powerPlan == null || powerPlan.IsActive) return; - WMI.Invoke("root\\CIMV2\\power", - "Win32_PowerPlan", - "InstanceID", - powerPlan.InstanceID, - "Activate"); + CMD.ExecuteProcess("powercfg", $"/s {powerPlan.Guid}"); } private static PowerPlan Create(PropertyDataCollection properties) diff --git a/LenovoLegionToolkit.WPF/LenovoLegionToolkit.WPF.csproj b/LenovoLegionToolkit.WPF/LenovoLegionToolkit.WPF.csproj index 6af0d6f548..8044fdfd5f 100644 --- a/LenovoLegionToolkit.WPF/LenovoLegionToolkit.WPF.csproj +++ b/LenovoLegionToolkit.WPF/LenovoLegionToolkit.WPF.csproj @@ -6,8 +6,8 @@ icon.ico Lenovo Legion Toolkit © 2021 Bartosz Cichecki - 1.5.1 - 1.5.1 + 1.5.2 + 1.5.2 disable true false