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, and WinPEStartup profile
        selectors for the specified architecture. Canceling a selector leaves its matching
        result empty. 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, 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
    )

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

    $SelectedDrivers = Select-OSDeployCoreWinpeDrivers -Architecture $Architecture -SkipWifiDrivers:$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 Profiles: $Script:OSDeployBootAssetsPath\winpestartup-profiles"

    $SelectedStartupProfiles = Select-BuildOSDeployBootWinPEStartupProfiles

    [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)
        WinPEStartupProfile  = @($SelectedStartupProfiles | Select-Object -ExpandProperty FullName)
    }
}