private/BootMedia/Steps/Select-OSDeployCoreWinRESource.ps1
|
#Requires -PSEdition Core function Select-OSDeployCoreWinRESource { <# .SYNOPSIS Displays imported WinRE sources in an Out-GridView picker. .DESCRIPTION Wraps Get-OSDeployCoreWinRESource and presents the results in an Out-GridView for interactive selection. .PARAMETER Architecture Filter by architecture before displaying the picker. .NOTES Author: David Segura Version: 0.1.0 #> [CmdletBinding()] param ( [ValidateSet('amd64', 'arm64')] [System.String] $Architecture ) $params = @{} if ($Architecture) { $params.Architecture = $Architecture } $results = Get-OSDeployCoreWinRESource @params if ($results) { if (@($results).Count -eq 1) { Write-OSDeployCoreProgress 'Auto-selected the only available Windows Recovery Image' return $results } Write-OSDeployCoreProgress 'Select a Windows Recovery Image and press OK (Cancel to skip)' $results = $results | Out-GridView -Title 'Select a Windows Recovery Image and press OK (Cancel to skip)' -OutputMode Single return $results } else { Write-Warning 'No WinRE sources available for selection' return $null } } |