Inputs: The desired power plan name
Minimum ITScripts engine version required: 184.108.40.206
Modifies the target machine: Yes
Name: Set Power Plan
Outputs: A status message indicating if the operation was successful.
Purpose: This script allows you to set the OS power plan on the target machine.
Script Version: 220.127.116.11
Target Type: Any
For Windows 7/Windows Server 2008 R2 systems or later, this script connects to the target sysem via WMI. Accessing the Win32_PowerPlan class, it sets the plan accordingly, based on user input. For systems older than Windows 7/Windows Server 2008 R2, the Win32_PowerPlan class did not exist so changes are made via the Powercfg.exe command. The command is executed remotely and the results are piped to a file and read back. As a result, systems that use the powercfg.exe method take longer to process the script.
Possible Operations Monitor results include:
"Power plan <current plan> is currently active."
"Updated the active power plan from <current plan> to <input plan>."
"No change is required. Power plan <current plan> is already active."
"No changes were made. No suitable power plan matched the input criteria <invalid input plan>."
"Failed to update the active power plan from <current plan> to <input plan>."
"No changes were made. Multiple plans matched the input criteria, <input plan>."
"WMI connection to the target machine failed. The machine may be offline or firewalled."