private/Select-OSDeployCoreBootMedia.ps1

function Select-OSDeployCoreBootMedia {
    <#
    .SYNOPSIS
        Selects a completed OSDeploy Boot media folder
 
    .DESCRIPTION
        Gets completed BootImage builds from the OSDeployCore boot directory and displays
        them in a single-selection Out-GridView picker. A warning is written when no
        completed builds are available. Canceling the picker returns no object.
 
    .EXAMPLE
        PS> Select-OSDeployCoreBootMedia
 
        Displays completed BootImage build folders and returns the selected item.
 
    .INPUTS
        None. This function does not accept pipeline input.
 
    .OUTPUTS
        System.Management.Automation.PSCustomObject. Returns the selected object with Name,
        Path, and ModifiedTime properties, or no object when no build is selected.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Version: 0.1.0
        Date: 2026-08-28
 
    .LINK
        Get-OSDeployCoreBootMedia
    #>

    [CmdletBinding()]
    param ()
    #=================================================
    $Error.Clear()
    Write-Verbose "[$($MyInvocation.MyCommand.Name)] Start"
    #=================================================
    $results = Get-OSDeployCoreBootMedia

    if ($results) {
        Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] Select an OSDeploy Boot folder and press OK (Cancel to exit)"
        $results = $results | Out-GridView -Title 'Select an OSDeploy Boot folder and press OK (Cancel to exit)' -OutputMode Single
        return $results
    }
    else {
        Write-Warning "[$(Get-Date -Format s)] No completed BootImage builds were found in $Script:OSDeployCorePath\boot"
    }
    #=================================================
    Write-Verbose "[$($MyInvocation.MyCommand.Name)] End"
    #=================================================
}