mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Processes unattend from a temp copy
Copies the source answer file to local temp storage before use, preserving the original media file and failing fast if the working copy cannot be prepared.
This commit is contained in:
@@ -1092,14 +1092,25 @@ if (Test-Path -Path $PPKGFolder) {
|
|||||||
|
|
||||||
#FindUnattend
|
#FindUnattend
|
||||||
$UnattendFolder = $USBDrive + "unattend\"
|
$UnattendFolder = $USBDrive + "unattend\"
|
||||||
$UnattendFilePath = $UnattendFolder + "unattend.xml"
|
$UnattendSourceFilePath = $UnattendFolder + "unattend.xml"
|
||||||
|
$UnattendWorkingFilePath = Join-Path -Path $env:TEMP -ChildPath 'unattend.xml'
|
||||||
$UnattendPrefixPath = $UnattendFolder + "prefixes.txt"
|
$UnattendPrefixPath = $UnattendFolder + "prefixes.txt"
|
||||||
$UnattendComputerNamePath = $UnattendFolder + "SerialComputerNames.csv"
|
$UnattendComputerNamePath = $UnattendFolder + "SerialComputerNames.csv"
|
||||||
If (Test-Path -Path $UnattendFilePath) {
|
If (Test-Path -Path $UnattendSourceFilePath) {
|
||||||
$UnattendFile = Get-ChildItem -Path $UnattendFilePath
|
$UnattendSourceFile = Get-ChildItem -Path $UnattendSourceFilePath
|
||||||
If ($UnattendFile) {
|
If ($UnattendSourceFile) {
|
||||||
|
try {
|
||||||
|
WriteLog "Copying source unattend file $($UnattendSourceFile.FullName) to temporary working file $UnattendWorkingFilePath"
|
||||||
|
Copy-Item -Path $UnattendSourceFile.FullName -Destination $UnattendWorkingFilePath -Force -ErrorAction Stop
|
||||||
|
$UnattendFile = Get-ChildItem -Path $UnattendWorkingFilePath -ErrorAction Stop
|
||||||
|
WriteLog "Using temporary unattend working file $($UnattendFile.FullName)"
|
||||||
$Unattend = $true
|
$Unattend = $true
|
||||||
}
|
}
|
||||||
|
catch {
|
||||||
|
WriteLog "Copying source unattend file to temporary working file failed with error: $_"
|
||||||
|
Stop-Script -Message "Copying source unattend file to temporary working file failed with error: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
If (Test-Path -Path $UnattendPrefixPath) {
|
If (Test-Path -Path $UnattendPrefixPath) {
|
||||||
$UnattendPrefixFile = Get-ChildItem -Path $UnattendPrefixPath
|
$UnattendPrefixFile = Get-ChildItem -Path $UnattendPrefixPath
|
||||||
|
|||||||
Reference in New Issue
Block a user