private/Step-BuildBootGetContentStartnet.ps1

#Requires -PSEdition Core

function Step-BuildBootGetContentStartnet {
    <#
    .SYNOPSIS
        Reads and stores the mounted image's startnet.cmd content
 
    .DESCRIPTION
        Reads Windows\System32\startnet.cmd from the mounted image as one string when
        the file exists. It stores the string in global BuildMedia.ContentStartnet and
        displays it through Out-Host. No state is changed when the file is absent.
 
    .EXAMPLE
        PS> Step-BuildBootGetContentStartnet
 
        Captures and displays startnet.cmd when it exists in the mounted image.
 
    .INPUTS
        None. This function does not accept pipeline input.
 
    .OUTPUTS
        None. The file content is sent to the host and stored in global BuildMedia.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Version: 0.1.0
        Date: 2026-08-28
 
        Requires global BuildMedia.MountPath. When the file exists, populates global
        BuildMedia.ContentStartnet with a System.String value.
    #>

    [CmdletBinding()]
    param ()

    $MountPath = $global:BuildMedia.MountPath
    $startnetPath = "$MountPath\Windows\System32\startnet.cmd"

    if (Test-Path $startnetPath) {
        Write-HostDateTimeDarkGray 'Startnet.cmd Content'
        [System.String]$ContentStartnet = Get-Content -Path $startnetPath -Raw
        $global:BuildMedia.ContentStartnet = $ContentStartnet
        $ContentStartnet | Out-Host
    }
}