public/Update-OSDeployCore.ps1

#Requires -PSEdition Core
#Requires -Version 7.4

function Update-OSDeployCore {
    <#
    .SYNOPSIS
        Updates all OSDeploy Core operating system and driver content
 
    .DESCRIPTION
        Refreshes local OSDeploy Core content by invoking Update-OSDeployCoreESD first,
        Update-OSDeployCoreRE second, and Update-OSDeployCoreDrivers last. This order makes
        downloaded and verified Enterprise ESD files available for Windows RE export before
        driver catalog refresh and package processing.
 
        Output from all three child commands is passed through in invocation order. Common
        parameter preferences, including -WhatIf and -Confirm, flow to the child commands.
 
    .EXAMPLE
        PS> Update-OSDeployCore
 
        Downloads missing Windows Enterprise ESD files, imports Windows OS and WinRE content,
        and updates WinPE driver packages.
 
    .EXAMPLE
        PS> Update-OSDeployCore -WhatIf
 
        Invokes all three child commands in update order and shows operations protected by
        ShouldProcess. Child commands can still perform checks or display confirmations, and
        verified cached ESD files can still be returned.
 
    .INPUTS
        None. This function does not accept pipeline input.
 
    .OUTPUTS
        System.IO.FileInfo. Returns verified or downloaded ESD files and driver package files
        emitted by the child commands.
 
        System.IO.DirectoryInfo. Returns destination directories for newly imported OS images.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Version: 1.0.0
        Date: 2026-08-28
 
        Requires Windows 11 25H2 or later, PowerShell 7.4 or later installed from MSI,
        curl.exe, and Administrator rights.
    #>

    [CmdletBinding(SupportsShouldProcess)]
    param ()
    #=================================================
    Write-HostOSDeployBanner
    #=================================================
    # Require License for this function. If the license is not valid, return without executing the function.
    if (-not (Test-OSDeployLicenseGate -CommandName $MyInvocation.MyCommand.Name)) {
        return
    }
    #=================================================
    # Stop before refreshing local content when a required host capability is missing.
    if (-not (Test-IsWindows11)) {
        throw "[$(Get-Date -Format s)] [$($MyInvocation.MyCommand.Name)] Windows 11 is required."
    }
    if (-not (Test-IsWindows1125H2)) {
        throw "[$(Get-Date -Format s)] [$($MyInvocation.MyCommand.Name)] Windows 11 25H2 (build 26200) is required."
    }
    if (-not (Test-PwshVersionMin)) {
        throw "[$(Get-Date -Format s)] [$($MyInvocation.MyCommand.Name)] PowerShell 7.4 or higher is required."
    }
    if (-not (Test-PwshPSHome)) {
        throw "[$(Get-Date -Format s)] [$($MyInvocation.MyCommand.Name)] The MSI installation of PowerShell 7 is required."
    }
    if (-not (Test-CommandCurl)) {
        throw "[$(Get-Date -Format s)] [$($MyInvocation.MyCommand.Name)] curl.exe is required but was not found in the current PATH. curl.exe ships with Windows 10 1803+."
    }
    if (-not (Test-IsAdministrator)) {
        throw "[$(Get-Date -Format s)] [$($MyInvocation.MyCommand.Name)] Administrator rights are required. Re-run PowerShell as Administrator and try again."
    }
    #=================================================
    # Refresh ESD files before exporting Windows RE sources and downloading drivers.
    Update-OSDeployCoreESD
    Update-OSDeployCoreRE
    Update-OSDeployCoreDrivers
}