private/BootMedia/Steps/Select-OSDeployCoreBuildStartupProfile.ps1
|
#Requires -PSEdition Core function Select-OSDeployCoreBuildStartupProfile { <# .SYNOPSIS Displays WinPE Startup profiles in an Out-GridView picker. .DESCRIPTION Enumerates JSON profiles from the core\OSDRe\winpe-profiles directory and presents them in an Out-GridView for multi-selection. Selected profiles will be copied into the mounted WinPE at WinPEStartup\Profiles during the build. .NOTES Author: David Segura Company: Recast Software Change Summary: - Initial version. #> [CmdletBinding()] param () $OSDRePaths = @(Join-Path $Script:OSDeployModuleBase 'core' 'OSDRe' 'winpe-profiles') $osdCloudBase = if (Get-Command -Name 'Get-OSDCloudModulePath' -ErrorAction SilentlyContinue) { Get-OSDCloudModulePath } if ($osdCloudBase) { $OSDRePaths += Join-Path $osdCloudBase 'core' 'OSDRe' 'winpe-profiles' } $osdBase = if (Get-Command -Name 'Get-OSDModulePath' -ErrorAction SilentlyContinue) { Get-OSDModulePath } if ($osdBase) { $OSDRePaths += Join-Path $osdBase 'core' 'OSDRe' 'winpe-profiles' } $OSDRePaths += Join-Path $Script:OSDeployCoreRepositoryPath 'winpe-profiles' $profileItems = @() foreach ($OSDRePath in $OSDRePaths) { if (Test-Path -LiteralPath $OSDRePath) { $profileItems += Get-ChildItem -LiteralPath $OSDRePath -Filter '*.json' -File -ErrorAction SilentlyContinue | Select-Object Name, FullName, LastWriteTime } } if ($profileItems -and $profileItems.Count -gt 0) { Write-OSDeployCoreProgress 'Select WinPE Startup Profiles to copy (Cancel to skip)' $selected = $profileItems | Out-GridView -PassThru -Title 'Select WinPE Startup Profiles to copy (Cancel to skip)' return $selected } return $null } |