Update create-power-plan.md

This commit is contained in:
Arash 2025-01-13 21:24:59 +03:30 committed by GitHub
parent 3e948575ba
commit 5ce045ca3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,23 +1,20 @@
<#
.SYNOPSIS
Create and Set Custom Power Plan
.DESCRIPTION
Creates a custom power plan based on the active power plan, renames it, and sets it as the active power plan.
This PowerShell script:
1. Retrieves the active power plan GUID.
2. Duplicates the active power plan.
3. Renames the new power plan to a custom name.
4. Sets the newly created power plan as the active plan.
.EXAMPLE
PS> ./create-custom-power-plan.ps1
.LINK
https://github.com/Arash-Seifi/PowerShell
.NOTES
Author: Arash Seifi | License: CC0
#>
## SYNOPSIS
Create and Set Custom Power Plan
## DESCRIPTION
Creates a custom power plan based on the active power plan, renames it, and sets it as the active power plan.
This PowerShell script:
1. Retrieves the active power plan GUID.
2. Duplicates the active power plan.
3. Renames the new power plan to a custom name.
4. Sets the newly created power plan as the active plan.
## EXAMPLE
PS> ./create-power-plan.ps1
## LINK
https://github.com/Arash-Seifi/PowerShell
## NOTES
Author: Arash Seifi | License: CC0
```
try {
# Step 1: Get the Active Power Plan GUID
$activeGuid = powercfg /getactivescheme | Select-String -Pattern "GUID" | ForEach-Object { $_.ToString().Split(' ')[3] }
@ -40,4 +37,5 @@ try {
catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
}
```