From 7b9fb2153afe0418ed0f51399938ad6e1aeb1c87 Mon Sep 17 00:00:00 2001 From: he3als <65787561+he3als@users.noreply.github.com> Date: Sat, 5 Oct 2024 00:15:09 +0100 Subject: [PATCH] refactor(svchost split): make readable --- .../performance/system/disable-service-host-split.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/playbook/Configuration/tweaks/performance/system/disable-service-host-split.yml b/src/playbook/Configuration/tweaks/performance/system/disable-service-host-split.yml index 3abafe4522..f758fdd7f4 100644 --- a/src/playbook/Configuration/tweaks/performance/system/disable-service-host-split.yml +++ b/src/playbook/Configuration/tweaks/performance/system/disable-service-host-split.yml @@ -4,5 +4,12 @@ description: Disables Service Host splitting for much lower RAM usage and proces actions: # https://learn.microsoft.com/en-us/windows/application-management/svchost-service-refactoring - !powerShell: - command: 'Get-ChildItem "HKLM:\SYSTEM\CurrentControlSet\Services" | ? { $_.Name -notmatch ''Xbl|Xbox'' } | % { $a = Get-ItemProperty -Path "REGISTRY::$_" -EA SilentlyContinue; if ($null -ne $a.Start) { Set-ItemProperty -Path "Registry::$_" -Name "SvcHostSplitDisable" -Type DWORD -Value 1 -Force -EA SilentlyContinue } }' + command: | + Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Services' | + Where-Object { $_.Name -notmatch 'Xbl|Xbox' } | + Foreach-Object { + if ($null -ne (Get-ItemProperty -Path """Registry::$_""" -EA 0).Start) { + Set-ItemProperty -Path """Registry::$_""" -Name 'SvcHostSplitDisable' -Type DWORD -Value 1 -Force -EA 0 -WhatIf + } + } wait: true