Skip to content

Commit eeb3c58

Browse files
authored
Added oscdimg downloader
1 parent 427e6af commit eeb3c58

File tree

2 files changed

+57
-5
lines changed

2 files changed

+57
-5
lines changed

tiny11Coremaker.ps1

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,15 +727,41 @@ Write-Host "Copying unattended file for bypassing MS account on OOBE..."
727727
Copy-Item -Path "$PSScriptRoot\autounattend.xml" -Destination "$mainOSDrive\tiny11\autounattend.xml" -Force >null
728728

729729
Write-Host "Creating ISO image..."
730+
# Define the path to the ADK Deployment Tools folder
730731
$ADKDepTools = "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture\Oscdimg"
732+
$localOSCDIMGPath = "$PSScriptRoot\oscdimg.exe"
733+
734+
# Check if the ADK Deployment Tools folder exists
731735
if ([System.IO.Directory]::Exists($ADKDepTools)) {
732736
Write-Host "Will be using oscdimg.exe from system ADK."
733737
$OSCDIMG = "$ADKDepTools\oscdimg.exe"
734738
} else {
735-
Write-Host "Will be using bundled oscdimg.exe."
736-
$OSCDIMG = "$PSScriptRoot\oscdimg.exe"
739+
Write-Host "ADK folder not found. Will be using bundled oscdimg.exe."
740+
741+
# Define the URL of the file to be downloaded
742+
$url = "https://msdl.microsoft.com/download/symbols/oscdimg.exe/3D44737265000/oscdimg.exe"
743+
744+
# Download oscdimg.exe if it doesn't exist in the script's directory
745+
if (-not (Test-Path -Path $localOSCDIMGPath)) {
746+
Write-Host "Downloading oscdimg.exe..."
747+
Invoke-WebRequest -Uri $url -OutFile $localOSCDIMGPath
748+
749+
# Check if the download was successful
750+
if (Test-Path $localOSCDIMGPath) {
751+
Write-Host "oscdimg.exe downloaded successfully."
752+
} else {
753+
Write-Error "Failed to download oscdimg.exe."
754+
exit 1
755+
}
756+
} else {
757+
Write-Host "oscdimg.exe already exists locally."
758+
}
759+
760+
$OSCDIMG = $localOSCDIMGPath
737761
}
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"
762+
763+
# Execute oscdimg.exe with the specified parameters
764+
& "$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"
739765

740766
# Finishing up
741767
Write-Host "Creation completed! Press any key to exit the script..."

tiny11maker.ps1

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,14 +409,40 @@ Write-Host "The tiny11 image is now completed. Proceeding with the making of the
409409
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..."
412+
# Define the path to the ADK Deployment Tools folder
412413
$ADKDepTools = "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\$hostarchitecture\Oscdimg"
414+
$localOSCDIMGPath = "$PSScriptRoot\oscdimg.exe"
415+
416+
# Check if the ADK Deployment Tools folder exists
413417
if ([System.IO.Directory]::Exists($ADKDepTools)) {
414418
Write-Host "Will be using oscdimg.exe from system ADK."
415419
$OSCDIMG = "$ADKDepTools\oscdimg.exe"
416420
} else {
417-
Write-Host "Will be using bundled oscdimg.exe."
418-
$OSCDIMG = "$PSScriptRoot\oscdimg.exe"
421+
Write-Host "ADK folder not found. Will be using bundled oscdimg.exe."
422+
423+
# Define the URL of the file to be downloaded
424+
$url = "https://msdl.microsoft.com/download/symbols/oscdimg.exe/3D44737265000/oscdimg.exe"
425+
426+
# Download oscdimg.exe if it doesn't exist in the script's directory
427+
if (-not (Test-Path -Path $localOSCDIMGPath)) {
428+
Write-Host "Downloading oscdimg.exe..."
429+
Invoke-WebRequest -Uri $url -OutFile $localOSCDIMGPath
430+
431+
# Check if the download was successful
432+
if (Test-Path $localOSCDIMGPath) {
433+
Write-Host "oscdimg.exe downloaded successfully."
434+
} else {
435+
Write-Error "Failed to download oscdimg.exe."
436+
exit 1
437+
}
438+
} else {
439+
Write-Host "oscdimg.exe already exists locally."
440+
}
441+
442+
$OSCDIMG = $localOSCDIMGPath
419443
}
444+
445+
# Execute oscdimg.exe with the specified parameters
420446
& "$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"
421447

422448
# Finishing up

0 commit comments

Comments
 (0)