It may be useful to automatically and temporarily switch to a "high performance" power plan from inside a script. Maybe you know that a script has to do CPU-intensive tasks, and you would like to speed it up a bit.
Here is how a script can change power plan settings:
# save current power plan: $PowerPlan = (Get-WmiObject -Name root\cimv2\power -Class Win32_PowerPlan -Filter 'isActive=True').ElementName "Current Power Plan: $PowerPlan" # turn on high performance power plan: (Get-WmiObject -Name root\cimv2\power -Class Win32_PowerPlan -Filter 'ElementName="High Performance"').Activate() # do something "Power Plan now is High Performance!" Start-Sleep -Seconds 3 # turn power plan back to what it was before: (Get-WmiObject -Name root\cimv2\power -Class Win32_PowerPlan -Filter "ElementName='$PowerPlan'").Activate() "Power Plan is back to $PowerPlan"