mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-29 13:14:49 +02:00
Update create-power-plan.md
This commit is contained in:
parent
3e948575ba
commit
5ce045ca3d
@ -1,23 +1,20 @@
|
|||||||
<#
|
## SYNOPSIS
|
||||||
.SYNOPSIS
|
Create and Set Custom Power Plan
|
||||||
Create and Set Custom Power Plan
|
## DESCRIPTION
|
||||||
.DESCRIPTION
|
Creates a custom power plan based on the active power plan, renames it, and sets it as the active power plan.
|
||||||
Creates a custom power plan based on the active power plan, renames it, and sets it as the active power plan.
|
This PowerShell script:
|
||||||
This PowerShell script:
|
1. Retrieves the active power plan GUID.
|
||||||
1. Retrieves the active power plan GUID.
|
2. Duplicates the active power plan.
|
||||||
2. Duplicates the active power plan.
|
3. Renames the new power plan to a custom name.
|
||||||
3. Renames the new power plan to a custom name.
|
4. Sets the newly created power plan as the active plan.
|
||||||
4. Sets the newly created power plan as the active plan.
|
## EXAMPLE
|
||||||
.EXAMPLE
|
PS> ./create-power-plan.ps1
|
||||||
PS> ./create-custom-power-plan.ps1
|
|
||||||
|
|
||||||
.LINK
|
|
||||||
https://github.com/Arash-Seifi/PowerShell
|
|
||||||
.NOTES
|
|
||||||
Author: Arash Seifi | License: CC0
|
|
||||||
#>
|
|
||||||
|
|
||||||
|
|
||||||
|
## LINK
|
||||||
|
https://github.com/Arash-Seifi/PowerShell
|
||||||
|
## NOTES
|
||||||
|
Author: Arash Seifi | License: CC0
|
||||||
|
```
|
||||||
try {
|
try {
|
||||||
# Step 1: Get the Active Power Plan GUID
|
# Step 1: Get the Active Power Plan GUID
|
||||||
$activeGuid = powercfg /getactivescheme | Select-String -Pattern "GUID" | ForEach-Object { $_.ToString().Split(' ')[3] }
|
$activeGuid = powercfg /getactivescheme | Select-String -Pattern "GUID" | ForEach-Object { $_.ToString().Split(' ')[3] }
|
||||||
@ -41,3 +38,4 @@ catch {
|
|||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user