mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-02-19 00:46:33 +00:00
Improve Windows feature enabling
This commit is contained in:
@@ -882,14 +882,14 @@ function ExecuteParameter {
|
||||
}
|
||||
"EnableWindowsSandbox" {
|
||||
Write-ToConsole "> Enabling Windows Sandbox..."
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Containers-DisposableClientVM" -All -NoRestart
|
||||
EnableWindowsFeature "Containers-DisposableClientVM"
|
||||
Write-ToConsole ""
|
||||
return
|
||||
}
|
||||
"EnableWindowsSubsystemForLinux" {
|
||||
Write-ToConsole "> Enabling Windows Subsystem for Linux..."
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "VirtualMachinePlatform" -All -NoRestart
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux" -All -NoRestart
|
||||
EnableWindowsFeature "VirtualMachinePlatform"
|
||||
EnableWindowsFeature "Microsoft-Windows-Subsystem-Linux"
|
||||
Write-ToConsole ""
|
||||
return
|
||||
}
|
||||
@@ -1048,6 +1048,18 @@ function CreateSystemRestorePoint {
|
||||
}
|
||||
|
||||
|
||||
# Enables a Windows optional feature and pipes its output to Write-ToConsole
|
||||
function EnableWindowsFeature {
|
||||
param (
|
||||
[string]$FeatureName
|
||||
)
|
||||
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName $FeatureName -All -NoRestart *>&1 `
|
||||
| Where-Object { $_ -isnot [Microsoft.Dism.Commands.ImageObject] -and $_.ToString() -notlike '*Restart is suppressed*' } `
|
||||
| ForEach-Object { $msg = $_.ToString().Trim(); if ($msg) { Write-ToConsole $msg } }
|
||||
}
|
||||
|
||||
|
||||
# Restart the Windows Explorer process
|
||||
function RestartExplorer {
|
||||
Write-ToConsole "> Attempting to restart the Windows Explorer process to apply all changes..."
|
||||
|
||||
Reference in New Issue
Block a user