@@ -728,14 +728,35 @@ Copy-Item -Path "$PSScriptRoot\autounattend.xml" -Destination "$mainOSDrive\tiny
728728
729729Write-Host " Creating ISO image..."
730730$ADKDepTools = " C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture \Oscdimg"
731+ $localOSCDIMGPath = " $PSScriptRoot \oscdimg.exe"
732+
731733if ([System.IO.Directory ]::Exists($ADKDepTools )) {
732734 Write-Host " Will be using oscdimg.exe from system ADK."
733735 $OSCDIMG = " $ADKDepTools \oscdimg.exe"
734736} else {
735- Write-Host " Will be using bundled oscdimg.exe."
736- $OSCDIMG = " $PSScriptRoot \oscdimg.exe"
737+ Write-Host " ADK folder not found. Will be using bundled oscdimg.exe."
738+
739+
740+ $url = " https://msdl.microsoft.com/download/symbols/oscdimg.exe/3D44737265000/oscdimg.exe"
741+
742+ if (-not (Test-Path - Path $localOSCDIMGPath )) {
743+ Write-Host " Downloading oscdimg.exe..."
744+ Invoke-WebRequest - Uri $url - OutFile $localOSCDIMGPath
745+
746+ if (Test-Path $localOSCDIMGPath ) {
747+ Write-Host " oscdimg.exe downloaded successfully."
748+ } else {
749+ Write-Error " Failed to download oscdimg.exe."
750+ exit 1
751+ }
752+ } else {
753+ Write-Host " oscdimg.exe already exists locally."
754+ }
755+
756+ $OSCDIMG = $localOSCDIMGPath
737757}
738- & " $OSCDIMG " ' -m' ' -o' ' -u2' ' -udfver102' " -bootdata:2#p0,e,b$mainOSDrive \tiny11\boot\etfsboot.com#pEF,e,b$mainOSDrive \tiny11\efi\microsoft\boot\efisys.bin" " $mainOSDrive \tiny11" " $PSScriptRoot \tiny11.iso"
758+
759+ & " $OSCDIMG " ' -m' ' -o' ' -u2' ' -udfver102' " -bootdata:2#p0,e,b$ScratchDisk \tiny11\boot\etfsboot.com#pEF,e,b$ScratchDisk \tiny11\efi\microsoft\boot\efisys.bin" " $ScratchDisk \tiny11" " $PSScriptRoot \tiny11.iso"
739760
740761# Finishing up
741762Write-Host " Creation completed! Press any key to exit the script..."
0 commit comments