private/Step-BuildBootInstallWinPEAppCurl.ps1
|
#Requires -PSEdition Core function Step-BuildBootInstallWinPEAppCurl { <# .SYNOPSIS Copies curl.exe from the running Windows installation into the mounted image .DESCRIPTION Copies System32\curl.exe from the running Windows installation to Windows\System32\curl.exe in the mounted WinPE image, overwriting an existing destination. The function writes a warning and returns when the source file is absent. Copy errors are silently ignored. .EXAMPLE PS> Step-BuildBootInstallWinPEAppCurl Copies the host curl.exe binary into the mounted WinPE image when available. .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.MountPath and the SystemRoot environment variable. Modifies the mounted image when the host curl.exe exists. #> [CmdletBinding()] param () $MountPath = $global:BuildMedia.MountPath $SourceCurl = "$env:SystemRoot\System32\curl.exe" $DestinationCurl = Join-Path $MountPath 'Windows\System32\curl.exe' Write-HostDateTimeDarkGray 'Step-BuildBootInstallWinPEAppCurl' if (-not (Test-Path -Path $SourceCurl)) { Write-Warning "[$(Get-Date -Format s)] curl.exe not found at $SourceCurl" return } Write-Host -ForegroundColor DarkGray "[$(Get-Date -format s)] [INFO] Copying curl.exe from $SourceCurl" Copy-Item -Path $SourceCurl -Destination $DestinationCurl -Force -ErrorAction SilentlyContinue } |