diff --git a/README.md b/README.md index 9e92baf..cb7fb13 100644 --- a/README.md +++ b/README.md @@ -98,9 +98,9 @@ Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force; ls -Recurse *.ps*1 | - Disable heavy Services; ([`optimize-services.ps1`](./src/scripts/optimize-services.ps1)) - Remove Bloatware Apps that comes with Windows 10, except from my choice; ([`remove-bloatware-apps.ps1`](./src/scripts/remove-bloatware-apps.ps1)) - Optimize Privacy and Performance settings disabling more telemetry stuff and changing GPOs; ([`optimize-privacy-and-performance.ps1`](./src/scripts/optimize-privacy-and-performance.ps1)) -- Apply General Personalization tweaks via Registry and Powershell commands; ([`personal-optimizations.ps1`](./src/scripts/personal-optimizations.ps1)) +- Apply General Personalization tweaks via Registry and Powershell commands; ([`personal-tweaks.ps1`](./src/scripts/personal-tweaks.ps1)) - Help improve the Security of Windows by a little; ([`optimize-security.ps1`](./src/scripts/optimize-security.ps1)) -- Enable Optional Features specially for Gaming/Work (including WSL 2); ([`enable-optional-features.ps1`](./src/scripts/enable-optional-features.ps1)) +- Disable and Enable Optional Features specially for Gaming/Work (including WSL 2); ([`optimize-optional-features.ps1`](./src/scripts/optimize-optional-features.ps1)) - Remove OneDrive completely from the System, re-install is possible via Win Store; ([`remove-onedrive.ps1`](./src/scripts/remove-onedrive.ps1)) - Install _Chocolatey/Winget_ by default; ([`install-package-managers.ps1`](./src/scripts/install-package-managers.ps1)) - In the End it Locks Script's Usage Permission. (`Win10Script(GUI).ps1`) diff --git a/Win10Script.ps1 b/Win10Script.ps1 index 3657bb8..dc2b47e 100644 --- a/Win10Script.ps1 +++ b/Win10Script.ps1 @@ -59,9 +59,9 @@ function RunScripts() { "optimize-services.ps1" "remove-bloatware-apps.ps1" "optimize-privacy-and-performance.ps1" - "personal-optimizations.ps1" + "personal-tweaks.ps1" "optimize-security.ps1" - "enable-optional-features.ps1" + "optimize-optional-features.ps1" "remove-onedrive.ps1" "install-package-managers.ps1" ) diff --git a/Win10ScriptGUI.ps1 b/Win10ScriptGUI.ps1 index a0f9c05..d972269 100644 --- a/Win10ScriptGUI.ps1 +++ b/Win10ScriptGUI.ps1 @@ -445,9 +445,9 @@ function PrepareGUI() { "optimize-services.ps1" "remove-bloatware-apps.ps1" "optimize-privacy-and-performance.ps1" - "personal-optimizations.ps1" + "personal-tweaks.ps1" "optimize-security.ps1" - "enable-optional-features.ps1" + "optimize-optional-features.ps1" "remove-onedrive.ps1" ) @@ -500,7 +500,7 @@ function PrepareGUI() { "optimize-scheduled-tasks.ps1" "optimize-services.ps1" "optimize-privacy-and-performance.ps1" - "personal-optimizations.ps1" + "personal-tweaks.ps1" ) ForEach ($FileName in $Scripts) { diff --git a/src/scripts/enable-optional-features.ps1 b/src/scripts/optimize-optional-features.ps1 similarity index 52% rename from src/scripts/enable-optional-features.ps1 rename to src/scripts/optimize-optional-features.ps1 index 1c65204..1f8baef 100644 --- a/src/scripts/enable-optional-features.ps1 +++ b/src/scripts/optimize-optional-features.ps1 @@ -1,15 +1,40 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1" -function EnableOptionalFeatures() { +# Adapted from: https://github.com/ChrisTitusTech/win10script/pull/131/files + +function OptimizeOptionalFeatures() { Title1 -Text "Install additional features for Windows" # Dism /online /Get-Features #/Format:Table # To find all features # Get-WindowsOptionalFeature -Online + + $DisableFeatures = @( + "FaxServicesClientPackage" # Windows Fax and Scan + "LegacyComponents" # Legacy Components + "MediaPlayback" # Media Features + "MicrosoftWindowsPowerShellV2" # PowerShell 2.0 + "MicrosoftWindowsPowershellV2Root" # PowerShell 2.0 + "Printing-PrintToPDFServices-Features" # Microsoft Print to PDF + "Printing-XPSServices-Features" # Microsoft XPS Document Writer + "WorkFolders-Client" # Work Folders Client + ) + + ForEach ($Feature in $DisableFeatures) { + + $FeatureDetails = $(Get-WindowsOptionalFeature -Online -FeatureName $Feature) + + Write-Host "[?][Feature] $Feature Status:" $FeatureDetails.State + + If ($FeatureDetails.State -like "Enabled") { + + Write-Host "[-][Feature] Uninstalling $Feature..." + Disable-WindowsOptionalFeature -Online -NoRestart -FeatureName $Feature + + } + } - $Features = @( - "LegacyComponents" # Legacy Components - "DirectPlay" # Direct Play + $EnableFeatures = @( "Microsoft-Hyper-V-All" # Hyper-V (VT-d (Intel) / SVM (AMD) needed on BIOS) "NetFx3" # NET Framework 3.5 "NetFx4-AdvSrvs" # NET Framework 4 @@ -20,19 +45,18 @@ function EnableOptionalFeatures() { "VirtualMachinePlatform" # VM Platform ) - ForEach ($Feature in $Features) { + ForEach ($Feature in $EnableFeatures) { $FeatureDetails = $(Get-WindowsOptionalFeature -Online -FeatureName $Feature) - Write-Host "Checking if $Feature was already installed..." - Write-Host "$Feature Status:" $FeatureDetails.State - If ($FeatureDetails.State -like "Enabled") { - Write-Host "[=][Feature] $Feature was already installed! Skipping..." - } - ElseIf ($FeatureDetails.State -like "Disabled") { + Write-Host "[?][Feature] Checking if $Feature was already installed..." + Write-Host "[?][Feature] $Feature Status:" $FeatureDetails.State + + If ($FeatureDetails.State -like "Disabled*") { + Write-Host "[+][Feature] Installing $Feature..." Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName $Feature + } - Write-Host "" } # This is for WSL 2 @@ -41,7 +65,6 @@ function EnableOptionalFeatures() { Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" -Name "AllowDevelopmentWithoutDevLicense" -Type DWord -Value 1 Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" -Name "AllowAllTrustedApps" -Type DWord -Value 1 } - wsl --set-default-version 2 wsl --list --online @@ -49,7 +72,7 @@ function EnableOptionalFeatures() { function Main() { - EnableOptionalFeatures # Enable features claimed as Optional on Windows, but actually, they are useful + OptimizeOptionalFeatures # Disable useless features and Enable features claimed as Optional on Windows, but actually, they are useful } diff --git a/src/scripts/optimize-privacy-and-performance.ps1 b/src/scripts/optimize-privacy-and-performance.ps1 index 61a9039..1d110ff 100644 --- a/src/scripts/optimize-privacy-and-performance.ps1 +++ b/src/scripts/optimize-privacy-and-performance.ps1 @@ -6,7 +6,7 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1" # Adapted from this Sycnex script: https://github.com/Sycnex/Windows10Debloater # Adapted from this kalaspuffar/Daniel Persson script: https://github.com/kalaspuffar/windows-debloat -function TweaksForPrivacyAndPerformance() { +function OptimizePrivacyAndPerformance() { Title1 -Text "Privacy And Performance Tweaks" Section1 -Text "Personalization Section" @@ -347,7 +347,7 @@ function TweaksForPrivacyAndPerformance() { # Details: https://www.tenforums.com/tutorials/94628-change-split-threshold-svchost-exe-windows-10-a.html Write-Host "[+][Priv&Perf] Splitting SVCHost processes to lower RAM usage..." - Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control" -Name "SvcHostSplitThresholdInKB" -Type DWord -Value 4194304 + Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control" -Name "SvcHostSplitThresholdInKB" -Type DWord -Value $(4 * 1mb) Write-Host "[+][Priv&Perf] Unlimiting your network bandwitdh for all your system..." # Based on this Chris Titus video: https://youtu.be/7u1miYJmJ_4 If (!(Test-Path "$PathToPsched")) { @@ -421,7 +421,7 @@ function Main() { } - TweaksForPrivacyAndPerformance # Disable Registries that causes slowdowns and privacy invasion + OptimizePrivacyAndPerformance # Disable Registries that causes slowdowns and privacy invasion } diff --git a/src/scripts/personal-optimizations.ps1 b/src/scripts/personal-tweaks.ps1 similarity index 100% rename from src/scripts/personal-optimizations.ps1 rename to src/scripts/personal-tweaks.ps1