Skip to content

Commit e51044f

Browse files
authored
Merge pull request #195 from ntdevlabs/experimental
Add oscdimg downloader
2 parents 427e6af + af2e615 commit e51044f

File tree

2 files changed

+46
-5
lines changed

2 files changed

+46
-5
lines changed

tiny11Coremaker.ps1

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,14 +728,35 @@ Copy-Item -Path "$PSScriptRoot\autounattend.xml" -Destination "$mainOSDrive\tiny
728728

729729
Write-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+
731733
if ([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
741762
Write-Host "Creation completed! Press any key to exit the script..."

tiny11maker.ps1

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,33 @@ Write-Host "Copying unattended file for bypassing MS account on OOBE..."
410410
Copy-Item -Path "$PSScriptRoot\autounattend.xml" -Destination "$ScratchDisk\tiny11\autounattend.xml" -Force >null
411411
Write-Host "Creating ISO image..."
412412
$ADKDepTools = "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture\Oscdimg"
413+
$localOSCDIMGPath = "$PSScriptRoot\oscdimg.exe"
414+
413415
if ([System.IO.Directory]::Exists($ADKDepTools)) {
414416
Write-Host "Will be using oscdimg.exe from system ADK."
415417
$OSCDIMG = "$ADKDepTools\oscdimg.exe"
416418
} else {
417-
Write-Host "Will be using bundled oscdimg.exe."
418-
$OSCDIMG = "$PSScriptRoot\oscdimg.exe"
419+
Write-Host "ADK folder not found. Will be using bundled oscdimg.exe."
420+
421+
$url = "https://msdl.microsoft.com/download/symbols/oscdimg.exe/3D44737265000/oscdimg.exe"
422+
423+
if (-not (Test-Path -Path $localOSCDIMGPath)) {
424+
Write-Host "Downloading oscdimg.exe..."
425+
Invoke-WebRequest -Uri $url -OutFile $localOSCDIMGPath
426+
427+
if (Test-Path $localOSCDIMGPath) {
428+
Write-Host "oscdimg.exe downloaded successfully."
429+
} else {
430+
Write-Error "Failed to download oscdimg.exe."
431+
exit 1
432+
}
433+
} else {
434+
Write-Host "oscdimg.exe already exists locally."
435+
}
436+
437+
$OSCDIMG = $localOSCDIMGPath
419438
}
439+
420440
& "$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"
421441

422442
# Finishing up

0 commit comments

Comments
 (0)