Skip to content

Commit 4bbc8c3

Browse files
committed
Only set High Performance power plan to DESKTOP PCs (Laptops and other types will be ignored)
- Avoid thermonuclear mobile devices (reduces performance and BATTERY drain in these devices)
1 parent f1d09ea commit 4bbc8c3

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

src/lib/Get-HardwareInfo.psm1

+16
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,22 @@ function Get-DriveSpace() {
9898
return "$DriveLetter`: $($AvailableStorage.ToString("#.#"))/$($TotalStorage.ToString("#.#")) GB ($((($AvailableStorage / $TotalStorage) * 100).ToString("#.#"))%)"
9999
}
100100

101+
function Get-PCSystemType() {
102+
[CmdletBinding()]
103+
104+
$PCSystemType = Get-CimInstance -Class Win32_ComputerSystem | Select-Object -ExpandProperty PCSystemType
105+
106+
If ($PCSystemType -eq 1) {
107+
Write-Status -Types "@", "Info" -Status "Your PC is a Desktop ($PCSystemType)" -Warning
108+
} ElseIf ($PCSystemType -eq 2) {
109+
Write-Status -Types "@", "Info" -Status "Your PC is a Laptop ($PCSystemType)" -Warning
110+
} Else {
111+
Write-Status -Types "?", "Info" -Status "Your PC system type is Unknown ($PCSystemType)" -Warning
112+
}
113+
114+
return $PCSystemType
115+
}
116+
101117
function Get-SystemSpec() {
102118
[CmdletBinding()]
103119
[OutputType([System.Object[]])]

src/scripts/Optimize-Performance.ps1

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Open-File.psm1"
2+
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Get-HardwareInfo.psm1"
23
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Title-Templates.psm1"
34
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Unregister-DuplicatedPowerPlan.psm1"
45
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Set-ItemPropertyVerified.psm1"
@@ -32,6 +33,7 @@ function Optimize-Performance() {
3233
)
3334
}
3435

36+
$PCSystemType = Get-PCSystemType
3537
# Initialize all Path variables used to Registry Tweaks
3638
$PathToLMMultimediaSystemProfile = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile"
3739
$PathToLMMultimediaSystemProfileOnGameTasks = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games"
@@ -80,8 +82,14 @@ function Optimize-Performance() {
8082

8183
Write-Section "Power Plan Tweaks"
8284

83-
Write-Status -Types "+", $TweakType -Status "Setting Power Plan to High Performance..."
84-
powercfg -SetActive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
85+
If ($PCSystemType -eq 1) {
86+
Write-Status -Types "+", $TweakType -Status "Desktop ($PCSystemType): Setting Power Plan to High Performance..."
87+
powercfg -SetActive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
88+
} ElseIf ($PCSystemType -eq 2) {
89+
Write-Status -Types "@", $TweakType -Status "Laptop ($PCSystemType): Keeping current power plan..." -Warning
90+
} Else {
91+
Write-Status -Types "@", $TweakType -Status "Unknown ($PCSystemType): Keeping current power plan..." -Warning
92+
}
8593

8694
Write-Status -Types "+", $TweakType -Status "Creating the Ultimate Performance hidden Power Plan..."
8795
powercfg -DuplicateScheme e9a42b02-d5df-448d-aa00-03f14749eb61

0 commit comments

Comments
 (0)