I'm looking for either a PowerShell script or command that allows me to get the active power plan's time until sleep.
In the below example, I know from the previous screen that "Balanced" is the Active Power plan. Selecting that, gets to this screen where I can see this info.
I've currently tried places in both WMI and the registry, but everything is set to GUIDs and you have to pull the Active Powerplan first. I have also tried powercfg
and it various commands.
Do I have to query the active powerplan with powercfg, parse that response, so I only get the GUID, and then query using that result in the registry or WMI?
Looking for some guidance or even some code.
powercfg
has a flag/GETACTIVESCHEME
which will help, then you need to isolate the GUID. You can use this to reduce the output ofpowercfg /QUERY
. You can also find the active plan withGet-WmiObject -Class win32_powerplan -Namespace root\cimv2\power -Filter "isActive='true'"