Fixed the documnet format

This commit is contained in:
Arash-Seifi 2025-01-13 21:20:20 +03:30
parent 3edd43899a
commit 3e948575ba

View File

@ -11,7 +11,6 @@
.EXAMPLE .EXAMPLE
PS> ./create-custom-power-plan.ps1 PS> ./create-custom-power-plan.ps1
.LINK .LINK
https://github.com/Arash-Seifi/PowerShell https://github.com/Arash-Seifi/PowerShell
.NOTES .NOTES
@ -20,19 +19,25 @@
try { try {
Add-Type -AssemblyName System.Speech # Step 1: Get the Active Power Plan GUID
$activeGuid = powercfg /getactivescheme | Select-String -Pattern "GUID" | ForEach-Object { $_.ToString().Split(' ')[3] }
Write-Output "Active Power Plan GUID: $activeGuid"
$Synth = New-Object System.Speech.Synthesis.SpeechSynthesizer # Step 2: Duplicate the Active Power Plan and capture the new GUID
$newGuid = powercfg -duplicatescheme $activeGuid | ForEach-Object { $_.ToString().Split(' ')[3] }
Write-Output "New Power Plan GUID: $newGuid"
$Synth.GetInstalledVoices() | # Step 3: Rename the New Power Plan
Select-Object -ExpandProperty VoiceInfo | $customName = "My Custom Plan"
Select-Object -Property Name, Culture, Gender, Age powercfg -changename $newGuid $customName
# Indicate success and exit with status 0 # Step 4: Set the New Power Plan as Active
exit 0 powercfg -setactive $newGuid
# Output the new power plan GUID
Write-Output "New power plan created with GUID: $newGuid and set as active."
} }
catch { catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }