I am running my new notebook computer with the following power plan, which specifies that the machine shuts down after one hour of idleness:
However, I do not want the machine powering-down when a long-running backup is running. To solve this problem:
SetPowerPlan.ps1:
param($PreferredPlan) function SetPowerPlan([string]$PreferredPlan) { Write-Host "Setting Powerplan to $PreferredPlan" $guid = (Get-WmiObject -Class win32_powerplan -Namespace root\cimv2\power -Filter "ElementName='$PreferredPlan'").InstanceID.tostring() $regex = [regex]"{(.*?)}$" $newpowerVal = $regex.Match($guid).groups[1].value # setting power setting to high performance powercfg -S $newpowerVal } SetPowerPlan $PreferredPlan
Backup.ps1:
... & C:\PSScripts\SetPowerPlan.ps1 "Custom_Always_On" ... # code for potentially long-running backup ... & C:\PSScripts\SetPowerPlan.ps1 "Custom_Auto_Power_Down" ...
Now there is no risk of the machine powering-down in the middle of a long backup.
Use PowerShell to control your computer's power utilization
Title | Date |
Vault 3 Security Enhancements | October 24, 2023 |
Vault 3 is now available for Apple OSX M2 Mac Computers! | September 18, 2023 |
Vault (for Desktop) Version 0.77 Released | March 26, 2023 |
EBTCalc (Android) Version 1.44 is now available | October 12, 2021 |
Vault (Desktop) Version 0.72 Released | October 6, 2021 |
EBT Compass is Now Available for Android Devices | June 2, 2021 |
Convert a Windows 10 Notebook into a High-Capacity Photo Frame | April 3, 2021 |