mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-04-03 14:06:27 +00:00
16 lines
513 B
PowerShell
16 lines
513 B
PowerShell
|
|
# Enables a Windows optional feature and pipes its output to the console
|
||
|
|
function EnableWindowsFeature {
|
||
|
|
param (
|
||
|
|
[string]$FeatureName
|
||
|
|
)
|
||
|
|
|
||
|
|
$result = Invoke-NonBlocking -ScriptBlock {
|
||
|
|
param($name)
|
||
|
|
Enable-WindowsOptionalFeature -Online -FeatureName $name -All -NoRestart
|
||
|
|
} -ArgumentList $FeatureName
|
||
|
|
|
||
|
|
$dismResult = @($result) | Where-Object { $_ -is [Microsoft.Dism.Commands.ImageObject] }
|
||
|
|
if ($dismResult) {
|
||
|
|
Write-Host ($dismResult | Out-String).Trim()
|
||
|
|
}
|
||
|
|
}
|