Reputation: 3810
In my powershell script, I use
powercfg /setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 238c9fa8-0aad-41ed-83f4-97be242c8f20 29f6c1db-86da-48c5-9fdb-f2b67b1f44da 0
I wanted to later verify if the above value has been set or not. How do i verify this ?
I couldn't find any GET version of this SET command-option, like GETacvalueIndex ?
or is there any registry settings that gets set when we do this, so that I can verify it in windows registry ?
Upvotes: 2
Views: 1107
Reputation: 1
Maybe we can use PowerReadACValue
(https://learn.microsoft.com/en-us/windows/desktop/api/powersetting/nf-powersetting-powerreadacvalue)
For example (http://www.reza-aghaei.com/how-to-get-value-of-advanced-power-settings/)
[DllImport("powrprof.dll")]
static extern uint PowerGetActiveScheme(
IntPtr UserRootPowerKey,
ref IntPtr ActivePolicyGuid);
[DllImport("powrprof.dll")]
static extern uint PowerReadACValue(
IntPtr RootPowerKey,
ref Guid SchemeGuid,
ref Guid SubGroupOfPowerSettingGuid,
ref Guid PowerSettingGuid,
ref int Type,
ref int Buffer,
ref uint BufferSize);
public static void Foo()
{
var activePolicyGuidPTR = IntPtr.Zero;
PowerGetActiveScheme(IntPtr.Zero, ref activePolicyGuidPTR);
var activePolicyGuid = Marshal.PtrToStructure<Guid>(activePolicyGuidPTR);
var type = 0;
var value = 0;
var valueSize = 4u;
PowerReadACValue(IntPtr.Zero, ref activePolicyGuid,
ref GUID_SLEEP_SUBGROUP, ref GUID_STANDBY_TIMEOUT,
ref type, ref value, ref valueSize);
var message = $"Sleep after {value} seconds.";
}
Upvotes: 0