private/BootMedia/Steps/Select-OSDeployCoreBootImage.ps1
|
function Select-OSDeployCoreBootImage { <# .SYNOPSIS Interactively selects a completed BootImage build from the OSDeployCore boot-media directory. .DESCRIPTION Wraps Get-OSDeployCoreBootMedia with an Out-GridView prompt, returning the single BootImage the user selects, or $null if the list is empty or the user cancels. .OUTPUTS PSCustomObject with properties: Name, Path, ModifiedTime Returns $null when no builds are found or the user cancels. .NOTES Author: David Segura Company: Recast Software Version: 0.1.0 #> [CmdletBinding()] param () #================================================= $Error.Clear() Write-Verbose "[$(Get-Date -format G)] [$($MyInvocation.MyCommand.Name)] Start" #================================================= $results = Get-OSDeployCoreBootMedia if ($results) { Write-Host -ForegroundColor DarkGray "[$(Get-Date -format G)] [$($MyInvocation.MyCommand.Name)] Select a BootImage and press OK (Cancel to exit)" $results = $results | Out-GridView -Title 'Select a BootImage and press OK (Cancel to exit)' -OutputMode Single return $results } else { Write-Warning "[$(Get-Date -format G)] [$($MyInvocation.MyCommand.Name)] No completed BootImage builds were found in $Script:OSDeployCorePath\boot-media" } #================================================= Write-Verbose "[$(Get-Date -format G)] [$($MyInvocation.MyCommand.Name)] End" #================================================= } |