A Good ISO File is a Quiet ISO File

Well, the topic is at least true when automating deployment tests in UEFI-based virtual machines. When spinning up multiple VMs, the last thing you want to do is having the connect to each one of them and "Press any key to boot from CD or DVD….."

When automating builds, say no to this prompt!

Well, that's not to hard to fix, simply replace the usual efisys.bin with a efisys_noprompt.bin from Windows ADK 10. Below you find a script that takes a bootable WinPE ISO file from MDT or ConfigMgr, and converts to a new ISO file that asks no questions.

Tip: When creating empty VMs for this special ISO, make sure to set first boot device to the hard drive so you don't end up in an endless loop 🙂

<#
.Synopsis
    Sample script for Deployment Research
    For UEFI Deployments, modifies a WinPE ISO to not ask for "Press Any Key To Boot From..."

.DESCRIPTION
    Created: 2020-01-10
    Version: 1.0
     
    Author : Johan Arwidmark
    Twitter: @jarwidmark
    Blog   : https://deploymentresearch.com
 
    Disclaimer: This script is provided "AS IS" with no warranties, confers no rights and 
    is not supported by the author or DeploymentArtist..

.NOTES
    Requires Windows ADK 10 to be installed

.EXAMPLE
    N/A
#>

# Settings
$WinPE_Architecture = "amd64" # Or x86
$WinPE_InputISOfile = "C:\ISO\Zero Touch WinPE 10 x64.iso"
$WinPE_OutputISOfile = "C:\ISO\Zero Touch WinPE 10 x64 - NoPrompt.iso"
 
$ADK_Path = "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit"
$WinPE_ADK_Path = $ADK_Path + "\Windows Preinstallation Environment"
$OSCDIMG_Path = $ADK_Path + "\Deployment Tools" + "\$WinPE_Architecture\Oscdimg"

# Validate locations
If (!(Test-path $WinPE_InputISOfile)){ Write-Warning "WinPE Input ISO file does not exist, aborting...";Break}
If (!(Test-path $ADK_Path)){ Write-Warning "ADK Path does not exist, aborting...";Break}
If (!(Test-path $WinPE_ADK_Path)){ Write-Warning "WinPE ADK Path does not exist, aborting...";Break}
If (!(Test-path $OSCDIMG_Path)){ Write-Warning "OSCDIMG Path does not exist, aborting...";Break}

# Mount the Original ISO (WinPE_InputISOfile) and figure out the drive-letter
Mount-DiskImage -ImagePath $WinPE_InputISOfile
$ISOImage = Get-DiskImage -ImagePath $WinPE_InputISOfile | Get-Volume
$ISODrive = [string]$ISOImage.DriveLetter+":"

# Section added for BIOS Support
$TempFolder = "C:\Temp\ISO"
New-Item -Path $TempFolder -ItemType Directory -Force
Copy-Item "$ISODrive\*" $TempFolder -Recurse
Remove-Item (Join-Path $TempFolder "boot\bootfix.bin") -Force

# Dismount the Original ISO
Dismount-DiskImage -ImagePath $WinPE_InputISOfile

# Create a new bootable WinPE ISO file, based on the Original ISO, but using efisys_noprompt.bin instead
$BootData='2#p0,e,b"{0}"#pEF,e,b"{1}"' -f "$OSCDIMG_Path\etfsboot.com","$OSCDIMG_Path\efisys_noprompt.bin"
   
$Proc = Start-Process -FilePath "$OSCDIMG_Path\oscdimg.exe" -ArgumentList @("-bootdata:$BootData",'-u2','-udfver102',"$TempFolder\","`"$WinPE_OutputISOfile`"") -PassThru -Wait -NoNewWindow
if($Proc.ExitCode -ne 0)
{
    Throw "Failed to generate ISO with exitcode: $($Proc.ExitCode)"
}

About the author

Johan Arwidmark

0 0 votes
Article Rating
Subscribe
Notify of
guest
11 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
pitor
4 months ago

Hi Johan,
let's think the opposite way, is there any way to extend the amount of time the 'press any key to Boot from CD or DVD…' is getting shown ? If so where this can be done ? in context of rufus it is like this: https://github.com/pbatard/rufus/issues/1077#issuecomment-353973899, is there anything similar in context of oscdimg.exe ?

pitor
4 months ago

I'm just wondering is there any way that after successful installation of such iso, when the system restarts it does not start the whole installation again? is there any other way than another script which ejects the iso from the vm once it is restarting itself ?

Pitor
1 month ago

it was quite some time ago when I've been testing this, you are definitelly right for the UEFI boot, I'm not that certain for the BIOS boot, though

trackback

[…] Now that UEFI is ubiquitous, this poses a problem for unattended operating system deployment and other unattended tasks that you may desire to run from WinPE. The solution to this problem is to simply replace a efisys.bin with the efisys_noprompt.bin that's included with the Windows ADK tools. I say simple, but unfortunately it's not as simple as maybe it should be, so I've written a PowerShell script to replace the bin file to create a new boot image. This script requires that Windows ADK is installed on the system from which it is run. I developed this script based… Read more »

Jonathan
Jonathan
1 year ago

nvm….I should've realised it would be Powershell : )

Jonathan
Jonathan
1 year ago

Hi Johan,

Thanks very much for this.

Sorry, but I suck at scripting and don't recognise what kind of file extension I should save this as, .bat, ps1, etc?

Richard Reyes
Richard Reyes
2 years ago

Typo on line #18, it reads: "Requires Windows AK 10 to be installed". Should be: "Requires Windows ADK 10 to be installed". You're still my hero Johan!! Great article!!


>