1

On Windows 7 I can use the parameter getactivescheme to get this information. How can I get it on Windows 2003?

On Windows 7 I can run the following code:

PS C:\Users\e> powercfg -getactivescheme
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance)

On Windows 2003, I get an error:

PS G:\> powercfg -getactivescheme
Invalid Parameters -- try "/?" for help
PS G:\>

Anyone can help? Thanks.

1

1 Answer 1

2

This is a quote from Microsoft

/query, /q
Use the following command to query each scheme to find out the settings: powercfg /query scheme For example, if you run powercfg /query "always on", the settings for the Always On scheme appear. [...]

If you do not specify a particular scheme, the default scheme settings appear. For example, if you run powercfg /query, the settings of the current scheme appear. The current scheme is listed in the Power Options tool in Control Panel.

In Windows 7 Powercfg -query displays the name and GUID of your active scheme in the first line. Maybe the strategie for Windows 2003 would be similar. The following example shows you how to extract the scheme name with windows batch commands. Of course you can convert this example to powershell.

@echo off
powercfg -query > list.txt
set /p line=< list.txt  
for /F "tokens=2 delims=()" %%a in ("%line%") do set string=%%a
echo %string%
del list.txt
pause 

How it works

  • Pipe the output of powercfg -query to a temp text file
  • Read back only the first line of the temp file
  • strip out everything between ( and )
  • display the scheme name with echo
  • delete the temp file
3
  • Yes it does not work. It just shows some of the configurations of the active scheme, but no scheme name. Jan 23, 2013 at 2:35
  • PS G:\> powercfg /query Field Description Value ----------------- ----- Name Always On Numerical ID 3 Turn off monitor (AC) Not Supported Turn off monitor (DC) Not Supported Turn off hard disks (AC) Not Supported Turn off hard disks (DC) Not Supported System standby (AC) Not Supported System standby (DC) Not Supported System hibernates (AC) Not Supported System hibernates (DC) Not Supported Processor Throttle (AC) Not Supported Processor Throttle (DC) Not Supported PS G:\> Jan 23, 2013 at 2:36
  • In Windows 2003 it seems that it is the 4th line which contain the scheme name. In Windows 7 it is the first line. You have to customize the example.
    – nixda
    Jan 23, 2013 at 9:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .