Skip to content

Commit 623c095

Browse files
authored
22.10.2019
## Updated - Improved "Turn off Windows features" and "Turn off default background apps, except the followings..." sections - Total runtime reduced by ~ 10 sec. ## Обновлено - Улучшены разделы "Отключить компоненты" и "Запретить стандартным приложениям работать в фоновом режиме, кроме следующих..." - Общее время выполнения сокращено примерно на 10 с
1 parent 5a7d841 commit 623c095

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

Win 10.ps1

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -584,30 +584,27 @@ New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windo
584584
$features = @(
585585
# Windows Fax and Scan
586586
# Факсы и сканирование
587-
"FaxServicesClientPackage",
587+
"FaxServicesClientPackage"
588588
# Legacy Components
589589
# Компоненты прежних версий
590-
"LegacyComponents",
590+
"LegacyComponents"
591591
# Media Features
592592
# Компоненты работы с мультимедиа
593-
"MediaPlayback",
593+
"MediaPlayback"
594594
# PowerShell 2.0
595-
"MicrosoftWindowsPowerShellV2",
596-
"MicrosoftWindowsPowershellV2Root",
595+
"MicrosoftWindowsPowerShellV2"
596+
"MicrosoftWindowsPowershellV2Root"
597597
# Microsoft XPS Document Writer
598598
# Средство записи XPS-документов (Microsoft)
599-
"Printing-XPSServices-Features",
599+
"Printing-XPSServices-Features"
600600
# Microsoft Print to PDF
601601
# Печать в PDF (Майкрософт)
602-
"Printing-PrintToPDFServices-Features",
602+
"Printing-PrintToPDFServices-Features"
603603
# Work Folders Client
604604
# Клиент рабочих папок
605605
"WorkFolders-Client"
606606
)
607-
foreach ($feature in $features)
608-
{
609-
Disable-WindowsOptionalFeature -Online -FeatureName $feature -NoRestart
610-
}
607+
Disable-WindowsOptionalFeature -Online -FeatureName $features -NoRestart
611608
# Remove Windows capabilities
612609
# Удалить компоненты
613610
$IncludedApps = @(
@@ -637,9 +634,9 @@ Get-CimInstance -ClassName Win32_ShadowCopy | Remove-CimInstance
637634
# Turn off Windows Script Host
638635
# Отключить Windows Script Host
639636
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -PropertyType DWord -Value 0 -Force
640-
# Turn off default background apps except
641-
# Запретить стандартным приложениям работать в фоновом режиме, кроме
642-
$apps = @(
637+
# Turn off default background apps, except the followings...
638+
# Запретить стандартным приложениям работать в фоновом режиме, кроме следующих...
639+
$ExcludedApps = @(
643640
# Lock App
644641
"Microsoft.LockApp*"
645642
# Content Delivery Manager
@@ -654,14 +651,13 @@ $apps = @(
654651
# StartMenuExperienceHost
655652
"Microsoft.Windows.StartMenuExperienceHost*"
656653
)
657-
foreach ($app in $apps)
658-
{
659-
Get-ChildItem -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications -Exclude $apps |
660-
ForEach-Object -Process {
661-
New-ItemProperty -Path $_.PsPath -Name Disabled -PropertyType DWord -Value 1 -Force
662-
New-ItemProperty -Path $_.PsPath -Name DisabledByUser -PropertyType DWord -Value 1 -Force
663-
}
654+
$OFS = "|"
655+
Get-ChildItem -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications | Where-Object -FilterScript {$_.PSChildName -cnotmatch $ExcludedApps} |
656+
ForEach-Object -Process {
657+
New-ItemProperty -Path $_.PsPath -Name Disabled -PropertyType DWord -Value 1 -Force
658+
New-ItemProperty -Path $_.PsPath -Name DisabledByUser -PropertyType DWord -Value 1 -Force
664659
}
660+
$OFS = " "
665661
# Set power management scheme for desktop and laptop
666662
# Установить схему управления питания для стационарного ПК и ноутбука
667663
IF ((Get-CimInstance -ClassName Win32_ComputerSystem).PCSystemType -eq 1)

0 commit comments

Comments
 (0)