private/Steps/Step-BootImageIso.ps1
|
#Requires -PSEdition Core function Step-BootImageIso { <# .SYNOPSIS Creates bootable ISO file(s) from the build media using oscdimg.exe. .NOTES Author: David Segura Version: 0.1.0 Dependencies: Module Functions: New-OSDeployCoreWindowsAdkISO, Write-OSDeployCoreProgress Executables: oscdimg.exe Windows Features: Windows ADK #> [CmdletBinding()] param () $AdkRootPath = $global:BuildMedia.AdkRootPath $MediaIsoLabel = $global:BuildMedia.MediaIsoLabel $MediaPath = $global:BuildMedia.MediaPath $MediaPathEX = $global:BuildMedia.MediaPathEX $MediaRootPath = $global:BuildMedia.MediaRootPath Write-OSDeployCoreProgress "Creating bootable ISO in $MediaRootPath" # Copy Profiles from $env:ProgramData\OSDeployCore\OSDCloud\Profiles to $MediaPath\OSDCloud\Profiles $SourceProfilesPath = "$env:ProgramData\OSDeployCore\OSDCloud\Profiles" $DestinationProfilesPath = Join-Path -Path $MediaPath -ChildPath "OSDCloud\Profiles" if (Test-Path -Path $SourceProfilesPath) { Copy-Item -Path $SourceProfilesPath -Destination $DestinationProfilesPath -Recurse -Force } $Params = @{ MediaPath = $MediaPath IsoFileName = 'bootmedia.iso' IsoLabel = $MediaIsoLabel WindowsAdkRoot = $AdkRootPath IsoDirectory = $MediaRootPath } New-OSDeployCoreWindowsAdkISO @Params | Out-Null # Remove copied profiles from $MediaPath\OSDCloud\Profiles if (Test-Path -Path $DestinationProfilesPath) { Remove-Item -Path $DestinationProfilesPath -Recurse -Force } if ($MediaPathEX) { # Copy Profiles from $env:ProgramData\OSDeployCore\OSDCloud\Profiles to $MediaPathEX\OSDCloud\Profiles if ($MediaPathEX) { $DestinationProfilesPathEX = Join-Path -Path $MediaPathEX -ChildPath "OSDCloud\Profiles" if (Test-Path -Path $SourceProfilesPath) { Copy-Item -Path $SourceProfilesPath -Destination $DestinationProfilesPathEX -Recurse -Force } } $Params = @{ MediaPath = $MediaPathEX IsoFileName = 'bootmedia_ca2023.iso' IsoLabel = $MediaIsoLabel WindowsAdkRoot = $AdkRootPath IsoDirectory = $MediaRootPath } New-OSDeployCoreWindowsAdkISO @Params | Out-Null # Remove copied profiles from $MediaPathEX\OSDCloud\Profiles if (Test-Path -Path $DestinationProfilesPathEX) { Remove-Item -Path $DestinationProfilesPathEX -Recurse -Force } } } |