function Invoke-WPFFeatureInstall { <# .SYNOPSIS Installs selected Windows Features #> if($sync.ProcessRunning){ $msg = "[Invoke-WPFFeatureInstall] Install process is currently running." [System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning) return } $Features = (Get-WinUtilCheckBoxes)["WPFFeature"] Invoke-WPFRunspace -ArgumentList $Features -DebugPreference $DebugPreference -ScriptBlock { param($Features, $DebugPreference) $sync.ProcessRunning = $true Invoke-WinUtilFeatureInstall $Features $sync.ProcessRunning = $false Write-Host "===================================" Write-Host "--- Features are Installed ---" Write-Host "--- A Reboot may be required ---" Write-Host "===================================" } }