diff --git a/Scripts/Features/RestartExplorer.ps1 b/Scripts/Features/RestartExplorer.ps1 index e580920..c5cb510 100644 --- a/Scripts/Features/RestartExplorer.ps1 +++ b/Scripts/Features/RestartExplorer.ps1 @@ -18,7 +18,7 @@ function RestartExplorer { return } - $rebootFeatures = @(Get-RebootFeatureLabels) + $rebootFeatures = Get-RebootFeatureLabels foreach ($displayLabel in $rebootFeatures) { Write-Host "Warning: '$displayLabel' requires a reboot to take full effect" -ForegroundColor Yellow } diff --git a/Scripts/GUI/Show-ApplyModal.ps1 b/Scripts/GUI/Show-ApplyModal.ps1 index 12128a7..7985d8a 100644 --- a/Scripts/GUI/Show-ApplyModal.ps1 +++ b/Scripts/GUI/Show-ApplyModal.ps1 @@ -144,7 +144,7 @@ function Show-ApplyModal { # Show completion message with reboot instructions if any applied features require reboot if ($RestartExplorer) { - $rebootFeatures = @(Get-RebootFeatureLabels) + $rebootFeatures = Get-RebootFeatureLabels if ($rebootFeatures.Count -gt 0) { foreach ($featureName in $rebootFeatures) { diff --git a/Scripts/Helpers/Get-RebootFeatureLabels.ps1 b/Scripts/Helpers/Get-RebootFeatureLabels.ps1 index 815fc26..c5ab73f 100644 --- a/Scripts/Helpers/Get-RebootFeatureLabels.ps1 +++ b/Scripts/Helpers/Get-RebootFeatureLabels.ps1 @@ -8,7 +8,7 @@ UndoLabel when available. #> function Get-RebootFeatureLabels { - $rebootFeatureLabels = @() + $rebootFeatureLabels = [System.Collections.Generic.List[string]]::new() $candidateParamKeys = (@($script:Params.Keys) + @($script:UndoParams.Keys)) | Select-Object -Unique foreach ($paramKey in $candidateParamKeys) { @@ -18,7 +18,7 @@ function Get-RebootFeatureLabels { $displayLabel = if ($isUndo -and $feature.UndoLabel) { $feature.UndoLabel } else { $feature.Label } if (-not [string]::IsNullOrWhiteSpace([string]$displayLabel)) { - $rebootFeatureLabels += [string]$displayLabel + [void]$rebootFeatureLabels.Add([string]$displayLabel) } } }