private/Select-OSDeployBootProfileContent.ps1

#Requires -PSEdition Core

function Select-OSDeployBootProfileContent {
    <#
    .SYNOPSIS
        Selects shared content for an OSDeploy Boot profile
 
    .DESCRIPTION
        Runs the shared WinPE driver, build script, media script, WinpeStartup Core folder,
        and WinpeStartup profile selectors for the specified architecture. WinpeStartup Core
        folders are selected before WinpeStartup profiles. The shared main Core folder is
        included automatically when present and is not displayed in the picker. Canceling
        a selector leaves its matching result empty except for the automatic main Core
        folder. The function does not create or modify a profile.
 
    .PARAMETER Architecture
        Limits driver and script selection to amd64 or arm64.
 
    .PARAMETER SkipWifiDrivers
        Excludes Wi-Fi driver packages from the driver selector.
 
    .EXAMPLE
        PS> Select-OSDeployBootProfileContent -Architecture amd64
 
        Displays the shared content selectors and returns the selected paths.
 
    .INPUTS
        None. This function does not accept pipeline input.
 
    .OUTPUTS
        System.Management.Automation.PSCustomObject. Returns WinPEDriver, WinPEScript,
        MediaScript, WinpeStartupCore, and WinpeStartupProfile path properties.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Version: 1.0.0
        Date: 2026-09-03
    #>

    [CmdletBinding()]
    [OutputType([System.Management.Automation.PSCustomObject])]
    param (
        [Parameter(Mandatory)]
        [ValidateSet('amd64', 'arm64')]
        [System.String]
        $Architecture,

        [System.Management.Automation.SwitchParameter]
        $SkipWifiDrivers
    )

    $SelectedScripts = @(Select-OSDeployCoreBuildScript -Architecture $Architecture)
    Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] Boot WinPE Scripts: $Script:OSDeployBootAssetsPath\boot-winpescript"
    Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] Boot Media Scripts: $Script:OSDeployBootAssetsPath\boot-mediascript"

    Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] WinpeStartup Core: $Script:OSDeployBootAssetsPath\winpestartup-core"
    Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] WinpeStartup Core content will be staged to WinPE at X:\WinpeStartup\core"
    $SelectedStartupCore = Select-BuildOSDeployBootWinpeStartupCore

    Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] WinpeStartup Profiles: $Script:OSDeployBootAssetsPath\winpestartup-profiles"
    Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] WinpeStartup Profile content will be staged to WinPE at X:\WinpeStartup\profiles"
    $SelectedStartupProfiles = Select-BuildOSDeployBootWinpeStartupProfiles

    Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] WinPE Drivers: $Script:OSDeployBootAssetsPath\winpedrivers-$Architecture"
    $SelectedDrivers = Select-OSDeployCoreWinpeDrivers -Architecture $Architecture -SkipWifiDrivers:$SkipWifiDrivers

    [PSCustomObject]@{
        WinPEDriver          = @($SelectedDrivers | Select-Object -ExpandProperty FullName)
        WinPEScript          = @($SelectedScripts | Where-Object Type -EQ 'boot-winpescript' | Select-Object -ExpandProperty FullName)
        MediaScript          = @($SelectedScripts | Where-Object Type -EQ 'boot-mediascript' | Select-Object -ExpandProperty FullName)
        WinpeStartupCore     = @($SelectedStartupCore | Select-Object -ExpandProperty FullName)
        WinpeStartupProfile  = @($SelectedStartupProfiles | Select-Object -ExpandProperty FullName)
    }
}