private/BootMedia/Steps/Step-BootImageUpdateUSB.ps1
|
#Requires -PSEdition Core function Step-BootImageUpdateUSB { <# .SYNOPSIS Copies build media to a USB drive labeled USB-WinPE. .NOTES Author: David Segura Version: 0.1.0 #> [CmdletBinding()] param () $UpdateUSB = $global:BuildMedia.UpdateUSB $MediaPath = $global:BuildMedia.MediaPath if ($UpdateUSB -eq $true) { Write-OSDeployCoreProgress 'Update USB-WinPE Partition' $WinpeVolumes = Get-Volume | Where-Object { $_.FileSystemLabel -eq 'USB-WinPE' } if ($WinpeVolumes) { foreach ($volume in $WinpeVolumes) { $driveLetter = $volume.DriveLetter if ($driveLetter -and (Test-Path -Path "$($driveLetter):\")) { robocopy.exe "$MediaPath" "$($driveLetter):\" *.* /e /ndl /np /r:0 /w:0 /xd '$RECYCLE.BIN' 'System Volume Information' /xj } } } else { Write-Warning 'No USB partition labeled USB-WinPE found' } } } |