mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-12-17 09:45:22 +00:00
* Replace Tabs with Spaces to follow the conventions * Add Preprocessing in Compiler * Compile from Anywhere you want - Running 'Compile.ps1' Works in any directory you call it from * Code Formatting Changes * Result of Preprocessing Step in 'Compile.ps1' Script - Remove Trailing Whitespace Characters * Make Preprocessing more advanced * Move Preprocessing to a separate script file * Make Self Modification impossible for 'tools/Do-PreProcessing.ps1' Script - Make the workingdir same as sync.PSScriptRoot for consistency * Revert commit b5dffd671ff4f870026e4d384f393c0491692ab7 * Patched a Bug of some Excluded Files not actually get excluded in 'Get-ChildItem' PS Cmdlet * Update Replace Regex for Code Formatting in 'Do-PreProcessing' Script Tool * Rename 'Do-PreProcessing' to 'Invoke-Preprocessing' - Update some Comments * Make 'Invoke-Preprocessing' Modular - Update RegEx to handle more cases - Update Documentation - Add Validations & Useful feedback upon error * Replace Tabs with Spaces to follow the conventions - 'applications.json' File * Code Formatting Changes - 'Copy-Files' Private Function * Update Replace Regex for Code Formatting in 'Invoke-Preprocessing' Script Tool * Replace Tabs with Spaces to follow the conventions - Make 'ExcludedFiles' validation step check all filepaths before finally checking if any has failed * Result of 'Invoke-Preprocessing' Script * Update Replace Regex for Code Formatting in 'Invoke-Preprocessing' Script Tool
54 lines
2.0 KiB
PowerShell
54 lines
2.0 KiB
PowerShell
Function Invoke-WPFUltimatePerformance {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Creates or removes the Ultimate Performance power scheme
|
|
|
|
.PARAMETER State
|
|
Indicates whether to enable or disable the Ultimate Performance power scheme
|
|
|
|
#>
|
|
param($State)
|
|
try {
|
|
# Check if Ultimate Performance plan is installed
|
|
$ultimatePlan = powercfg -list | Select-String -Pattern "Ultimate Performance"
|
|
if($state -eq "Enable") {
|
|
if ($ultimatePlan) {
|
|
Write-Host "Ultimate Performance plan is already installed."
|
|
} else {
|
|
Write-Host "Installing Ultimate Performance plan..."
|
|
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61
|
|
Write-Host "> Ultimate Performance plan installed."
|
|
}
|
|
|
|
# Set the Ultimate Performance plan as active
|
|
$ultimatePlanGUID = (powercfg -list | Select-String -Pattern "Ultimate Performance").Line.Split()[3]
|
|
powercfg -setactive $ultimatePlanGUID
|
|
|
|
Write-Host "Ultimate Performance plan is now active."
|
|
|
|
|
|
}
|
|
elseif($state -eq "Disable") {
|
|
if ($ultimatePlan) {
|
|
# Extract the GUID of the Ultimate Performance plan
|
|
$ultimatePlanGUID = $ultimatePlan.Line.Split()[3]
|
|
|
|
# Set a different power plan as active before deleting the Ultimate Performance plan
|
|
$balancedPlanGUID = (powercfg -list | Select-String -Pattern "Balanced").Line.Split()[3]
|
|
powercfg -setactive $balancedPlanGUID
|
|
|
|
# Delete the Ultimate Performance plan
|
|
powercfg -delete $ultimatePlanGUID
|
|
|
|
Write-Host "Ultimate Performance plan has been uninstalled."
|
|
Write-Host "> Balanced plan is now active."
|
|
} else {
|
|
Write-Host "Ultimate Performance plan is not installed."
|
|
}
|
|
}
|
|
} catch {
|
|
Write-Warning $psitem.Exception.Message
|
|
}
|
|
}
|