POWERCFG - CMD


Overview

POWERCFG (Power Configuration) is a command-line utility in Windows operating systems used for managing and troubleshooting power settings. It provides extensive control over power plans, allowing users to adjust system power settings to optimize battery life and efficiency. POWERCFG is especially useful for systems administrators and power users who need to automate power management tasks across multiple computers.

Syntax

The basic syntax of the POWERCFG command is as follows:

POWERCFG [options]

The command supports a number of options that can be used to create, delete, modify, and view power schemes and their settings.

Options/Flags

Here are the primary options available with POWERCFG:

  • /LIST or /L: Lists all the power schemes available in the system.
  • /QUERY or /Q [Scheme_GUID] [Sub_GUID]: Displays the contents of a specified power scheme.
  • /CREATE or /X: Creates a new power scheme with a specified name.
  • /DELETE or /D [Scheme_GUID]: Deletes a power scheme.
  • /SETACTIVE or /S [Scheme_GUID]: Sets the specified power scheme as active.
  • /CHANGE or /X [Setting_GUID] [Value]: Modifies a power setting value in the active power scheme.
  • /EXPORT [File_path] [Scheme_GUID]: Exports a power scheme to a file.
  • /IMPORT [File_path] [Scheme_GUID]: Imports a power scheme from a file.
  • /BATTERYREPORT: Generates a detailed battery report.

Examples

  • Listing All Power Schemes:
    POWERCFG /LIST
    
  • Creating a New Power Scheme:
    POWERCFG /CREATE "My Custom Plan"
    
  • Deleting a Power Scheme:
    POWERCFG /DELETE [Scheme_GUID]
    
  • Setting an Active Power Scheme:
    POWERCFG /SETACTIVE [Scheme_GUID]
    
  • Modifying Power Settings:
    POWERCFG /CHANGE monitor-timeout-ac 5
    
  • Exporting a Power Scheme:
    POWERCFG /EXPORT "C:\backup.pow" [Scheme_GUID]
    

Common Issues

  • Invalid GUID Errors: Ensure that the GUIDs used (Scheme_GUID or Sub_GUID) are correct. You can list all available GUIDs using POWERCFG /L.
  • Permission Errors: POWERCFG commands may require administrative privileges, especially when modifying system settings or applying schemes globally.

Integration

POWERCFG can be integrated with scripts to automate the deployment of power settings across an organization. For example, using a simple batch script to set a default power plan on multiple machines:

@echo off
POWERCFG /SETACTIVE [Scheme_GUID]

Combine POWERCFG with SCHTASKS to adjust power settings based on tasks:

SCHTASKS /Create /TN "Change Power Plan" /TR "POWERCFG /SETACTIVE [Scheme_GUID]" /SC DAILY /ST 09:00
  • SCHTASKS: Manages scheduled tasks in Windows.
  • SHUTDOWN: Allows proper shutdown and restart of the computer from the command line.

Further resources and documentation can be accessed through the Microsoft official documentation.