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-OSDeployCoreCatalogs first, Update-OSDeployCoreESD second, Update-OSDeployCoreRE third, and Update-OSDeployCoreDrivers last. This order refreshes operating system catalogs before resolving Enterprise ESD files and makes downloaded and verified ESD files available for Windows RE export before driver catalog refresh and package processing. The OS release used for ESD download and import is selected from the host Windows build and exact ADK version. ADK 10.1.26100.2454 selects Windows 11 25H2; ADK 10.1.26100.9457 selects Windows 11 26H2 only when the host is also 26H2. Unsupported Windows or ADK versions stop the operation before updating content. Output from all four 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 four 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.Management.Automation.PSCustomObject. Returns the catalog update result emitted by Update-OSDeployCoreCatalogs. 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 (build 26200) or Windows 11 26H2 (build 26300), ADK 10.1.26100.2454 or 10.1.26100.9457, 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. $null = Get-OSDeployOperatingSystemTarget -RequireAdk 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 catalogs and ESD files before exporting Windows RE sources and downloading drivers. Update-OSDeployCoreCatalogs Update-OSDeployCoreESD Update-OSDeployCoreRE Update-OSDeployCoreDrivers } |