Windos ISO file corrupted

I am trying to do an in place upgrade to Windows 10 20H2. I have the ISO, I manually placed it on the server, renamed it to it’s SH1, and run the task. The ISO file gets downloaded to the client, but when the script tries to mount the ISO it fails saying that the file is corrupt. If I manually copy the file to a client I can mount it fine. It seems that BigFix is corrupting the file during prefetch.

To help figure out the problem, use BigFix to download and move the file to a destination directory, for example:
prefetch package.iso sha1…
move “__Download\package.iso” "c:\tmp\package.iso"
From the destination directory attempt to mount it, If it works fine, then the problem is somewhere else.

I figured out if I use a download command instead of prefetch the file does not get corrupted, so I can continue forward. However the script ran successfully once, but now it says it completed, and the files/ folders it is supposed to create get created, and it says it completes, but doesn’t do the upgrade. Here is the file as it ran last time. I have been making small changes so some things are commented out.

download now

//CLEANUP any old attempts
waithidden “{pathname of system folder & “\cmd.exe”}” /C rmdir “c:\temp\Win10” /S /Q

//create new installation folders
if {not exist folder “c:\temp”}
waithidden “{pathname of system folder & “\cmd.exe”}” /C mkdir "c:\temp"

if {not exist folder “c:\temp\Win10”}
waithidden “{pathname of system folder & “\cmd.exe”}” /C mkdir "c:\temp\Win10"

copy __Download\SW_DVD9_Win_Pro_10_20H2.10_64BIT_English_Pro_Ent_EDU_N_MLF_X22-76585.iso “c:\temp\Win10\SW_DVD9_Win_Pro_10_20H2.10_64BIT_English_Pro_Ent_EDU_N_MLF_X22-76585.iso”

// delete __Download\SW_DVD9_Win_Pro_10_20H2.10_64BIT_English_Pro_Ent_EDU_N_MLF_X22-76585.iso

//Start inplace upgrade
// if {free space of drive of client > 12000000000}

parameter “workISO” = "C:\temp\Win10\SW_DVD9_Win_Pro_10_20H2.10_64BIT_English_Pro_Ent_EDU_N_MLF_X22-76585.iso"
continue if {exists file (parameter “workISO”)}
//continue if {sha1 of file (parameter “workISO”) = “0d2ba7d974ad014dfcd26e3260af219ed4ac6b09”}

// prepare a workpath to temporary files.
parameter “workPath” = "{(value of variable “SystemDrive” of environment) & “\win10_upgrade_temp”}"
waithidden cmd /C rmdir /S /Q "{parameter “workPath”}"
waithidden cmd /C mkdir “{parameter “workPath”}”

// Create the cleanup file.
delete __appendfile
delete setupcomplete.cmd

appendfile @echo off
appendfile SET WindowsISO="{parameter “workISO”}"
// appendfile powershell.exe “Dismount-DiskImage “”%WindowsISO%”""
// appendfile rmdir /S /Q “{parameter “workPath”}”

move __appendfile setupcomplete.cmd

// Create a debug invocation batch to help in case of failures.
// This batch does not perform an update but with the scanonly option allows you to determine what the problem is.
delete __appendfile

appendfile @echo off
appendfile SET WindowsISO="{parameter “workISO”}“
appendfile FOR /F “skip=3” %%I IN ('powershell.exe “Get-DiskImage “””%WindowsISO%”"" | Get-Volume | Select-Object {{$_.DriveLetter}"’) DO %%I:\setup.exe /auto upgrade /Compat ScanOnly /DynamicUpdate disable"
appendfile echo %errorlevel% > “{parameter “workPath”}\out.log”

move __appendfile “{(parameter “workPath”) & “/upgradeCheck.bat”}”

// Create the actual invocation script
// Sleep and Dir were added or command would fail with %errorlevel% 183. Possibly a delay on mount.
delete __appendfile
delete mount.and.install.bat

appendfile @echo on
appendfile SET WindowsISO="{parameter “workISO”}“
appendfile powershell.exe “Mount-DiskImage “”%WindowsISO%””“
appendfile TIMEOUT 10
appendfile FOR /F “skip=3” %%I IN ('powershell.exe “Get-DiskImage “””%WindowsISO%”"" | Get-Volume | Select-Object {{$_.DriveLetter}"’) DO dir %%I: > “{parameter “workPath”}\dir.log” && %%I:\setup.exe /auto upgrade /Quiet /DynamicUpdate disable /postoobe "{pathname of client folder of current site & “\setupcomplete.cmd”}"
appendfile echo %errorlevel% > "{parameter “workPath”}\out.log"
move __appendfile mount.and.install.bat

wait mount.and.install.bat > “{parameter “workPath”}\cmd.log”

wait setupcomplete.cmd >"{parameter “workPath”}\setupcomplete.log"

// setup must finish with RC=0 at this stage if things are ok. If that is not the case content of C:"\win10_upgrade_temp dir holds useful info.
// Apart from log files, you can run upgradeCheck manually to check with the UI what the problem is.
folder delete “C:\temp\Win10”
// endif

So, when you say the file is corrupted, do you mean it fails the size or hash checks in the prefetch command?

My interpretation of corrupted is that file has been changed during the delivery, but you are not doing any of those checks on the download now - just assuming that it has arrived, therefore all is well.

No in the script where it tries to mount the ISO, it fails. When I then manually try to mount the ISO, it says the file is corrupted. I did resolve that by using a download now command instead of a prefetch, and it not corrupting the file now.
My problem now is that I got the action I posted above to work once, but it is now running and saying it has completed, but it doesn’t actually do the upgrade, and in the client log file it says all the steps were completed.

Re: the corrupted file.

Download Now command does not do a sha256 check and does not use the relay, but instead downloads the file directly from the URL. It also runs during the Action phase, instead of downloading prior to Action starting. I wonder if something is touching/changing the file after it is downloaded via prefetch prior to action running?

In the action, the download now is the first thing running, and it is getting the ISO to the client, and the script is able to mount the ISO, so the file being corrupted is not a problem any more.
The problem is the task completes, or it says it completed, but the upgrade never happens, and nothing in the client log tells me why.

When you used the prefetch,did you ‘copy’ or ‘move’ the ISO to your working directory?
‘move’ would retain the original permissions from the download directory - which may have limited access to the file and prevented you from mounting it. ‘copy’, as you are doing in this example, creates a new file with permissions based on your work directory.

1 Like