mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-02-19 08:56:25 +00:00
Improve Windows feature enabling
This commit is contained in:
@@ -882,14 +882,14 @@ function ExecuteParameter {
|
|||||||
}
|
}
|
||||||
"EnableWindowsSandbox" {
|
"EnableWindowsSandbox" {
|
||||||
Write-ToConsole "> Enabling Windows Sandbox..."
|
Write-ToConsole "> Enabling Windows Sandbox..."
|
||||||
Enable-WindowsOptionalFeature -Online -FeatureName "Containers-DisposableClientVM" -All -NoRestart
|
EnableWindowsFeature "Containers-DisposableClientVM"
|
||||||
Write-ToConsole ""
|
Write-ToConsole ""
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
"EnableWindowsSubsystemForLinux" {
|
"EnableWindowsSubsystemForLinux" {
|
||||||
Write-ToConsole "> Enabling Windows Subsystem for Linux..."
|
Write-ToConsole "> Enabling Windows Subsystem for Linux..."
|
||||||
Enable-WindowsOptionalFeature -Online -FeatureName "VirtualMachinePlatform" -All -NoRestart
|
EnableWindowsFeature "VirtualMachinePlatform"
|
||||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux" -All -NoRestart
|
EnableWindowsFeature "Microsoft-Windows-Subsystem-Linux"
|
||||||
Write-ToConsole ""
|
Write-ToConsole ""
|
||||||
return
|
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
|
# Restart the Windows Explorer process
|
||||||
function RestartExplorer {
|
function RestartExplorer {
|
||||||
Write-ToConsole "> Attempting to restart the Windows Explorer process to apply all changes..."
|
Write-ToConsole "> Attempting to restart the Windows Explorer process to apply all changes..."
|
||||||
|
|||||||
Reference in New Issue
Block a user