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