private/Get-SplitterUiExecutionPlan.ps1
|
function Get-SplitterUiExecutionPlan { [CmdletBinding()] param( [Parameter(Mandatory)] [hashtable] $InputState ) $sourceIso = [string] $InputState.SourceIso $workingRoot = [string] $InputState.WorkingRoot $outputRoot = [string] $InputState.OutputRoot $outputBaseName = [string] $InputState.OutputBaseName $labelPrefix = [string] $InputState.LabelPrefix $editionNames = @([string] $InputState.EditionNames -split ',' | ForEach-Object { $_.Trim() } | Where-Object { -not [string]::IsNullOrWhiteSpace($_) }) $errors = @() if ([string]::IsNullOrWhiteSpace($sourceIso)) { $errors += 'Source ISO is required.' } if ([string]::IsNullOrWhiteSpace($workingRoot)) { $errors += 'Working root is required.' } if ([string]::IsNullOrWhiteSpace($outputRoot)) { $errors += 'Output root is required.' } if ($editionNames.Count -eq 0) { $errors += 'At least one edition name is required.' } if ($InputState.IncludeDesktopExperience -and $InputState.IncludeServerCore) { $errors += 'Desktop Experience and Server Core filters cannot both be selected.' } if ($errors.Count -gt 0) { throw ($errors -join ' ') } $splitParams = @{ SourceIso = $sourceIso EditionName = $editionNames WorkingRoot = $workingRoot OutputRoot = $outputRoot PassThru = $true } if (-not [string]::IsNullOrWhiteSpace($outputBaseName)) { $splitParams.OutputBaseName = $outputBaseName } if (-not [string]::IsNullOrWhiteSpace($labelPrefix)) { $splitParams.LabelPrefix = $labelPrefix } if ($InputState.SkipBootableIso) { $splitParams.SkipBootableIso = $true } if ($InputState.IncludeDesktopExperience) { $splitParams.IncludeDesktopExperience = $true } if ($InputState.IncludeServerCore) { $splitParams.IncludeServerCore = $true } [pscustomobject]@{ SplitParams = $splitParams EditionNames = $editionNames } } |