private/BootMedia/Steps/Step-BootImageScript.ps1

#Requires -PSEdition Core

function Step-BootImageScript {
    <#
    .SYNOPSIS
        Runs user-selected WinPE scripts during the build.
 
    .NOTES
        Author: David Segura
        Version: 0.1.0
    #>

    [CmdletBinding()]
    param ()

    $WinPEScript = $global:BuildMedia.WinPEScript

    foreach ($Item in $WinPEScript) {
        if (Test-Path $Item) {
            Write-OSDeployCoreProgress "winpe-script: $Item"
            & "$Item"
        }
        else {
            Write-Warning "BootImage Script not found: $Item"
        }
    }
}