Skip to content

Releases: blast752/smartperformance

SmartPerformance v0.2.0: Real-time Power Event Monitoring and Enhanced Efficiency

10 May 10:22
e5152ad

Choose a tag to compare

Added

  • Functions have been created to increase modularity and readability:
    • Get-CurrentPowerPlan to get the current power plan.
    • Check-PowerStatus to check the power status (connected or disconnected).
  • A WMI event is registered to detect power management events and switch power plans dynamically in real-time without the need for a constant loop and sleep interval.
    • This improves the efficiency of the script as it only reacts to power events instead of continuously checking the power status.

Changed

  • The Set-PowerPlan function has been modified to only change the power plan if the new plan GUID is different from the current one.
    • This prevents unnecessary power plan changes and reduces the number of log messages.
  • The script now sets the initial power plan based on the current power status before starting to monitor power events.
  • The script now continuously waits for power events using the Wait-Event cmdlet instead of using a loop with a sleep interval.

Removed

  • The Log-ScriptInfo function and its invocation have been removed because is buggy.
  • The Get-PowerSource function has been replaced with the Check-PowerStatus function, which returns a boolean value indicating whether the power source is connected or not.
  • The Check-PowerProfileExists and Create-HighPerformancePlan functions have been removed, as the script assumes that the Balanced and High Performance power plans already exist on the system.

These changes make the new version of the script more efficient, easier to read, and more focused on its primary goal: automatically switching between Balanced and High Performance power plans based on the power source.