private/Step-BuildBootDismountWindowsImage.ps1

#Requires -PSEdition Core

function Step-BuildBootDismountWindowsImage {
    <#
    .SYNOPSIS
        Commits and dismounts the mounted Windows image
 
    .DESCRIPTION
        Pipes global BuildMedia.WindowsImage to Dismount-WindowsImage with Save and
        writes a timestamped servicing log under global BuildMedia.LogsPath. The
        cmdlet output is suppressed.
 
    .EXAMPLE
        PS> Step-BuildBootDismountWindowsImage
 
        Saves changes to the current mounted image and dismounts it.
 
    .INPUTS
        None. This function does not accept pipeline input.
 
    .OUTPUTS
        None.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Version: 0.1.0
        Date: 2026-08-28
 
        Requires global BuildMedia.WindowsImage and BuildMedia.LogsPath and the
        Dismount-WindowsImage cmdlet. Commits pending changes and ends the mount.
    #>

    [CmdletBinding()]
    param ()

    $LogsPath = $global:BuildMedia.LogsPath

    Write-HostDateTimeDarkGray 'Dismount-WindowsImage Save'
    $CurrentLog = "$LogsPath\$((Get-Date).ToString('yyMMdd-HHmmss'))-Dismount-WindowsImage.log"
    $global:BuildMedia.WindowsImage | Dismount-WindowsImage -Save -LogPath $CurrentLog | Out-Null
}