Creating a No-Prompt ConfigMgr Boot Image ISO

Here are two PowerShell scripts that can be used to create a No-Prompt ConfigMgr Boot Image ISO. This is particularly useful when performing large-scale deployments of virtual machines, or for any automation related to VM deployments, such as our Image Factory solution for ConfigMgr. The first script is used to create the boot image ISO. The second script is used to make the No-Prompt behavior and save it as a separate ISO.

New-BootImageISO.ps1

This script creates a ConfigMgr Boot Image ISO with default boot behavior. Change lines 5-9 to match your environment.

# Requires the script to be run under an administrative account context.
#Requires -RunAsAdministrator

# Set variables
$SiteCode = "PS1"
$DPName = "dp01.corp.viamonstra.com"
$MPName = "cm01.corp.viamonstra.com"
$ISOFile = "E:\Setup\Bootimage.iso"
$BootImageName = "WinPE 11 22H2 X64"

# Import ConfigMgr Module
Import-Module (Join-Path $(Split-Path $env:SMS_ADMIN_UI_PATH) ConfigurationManager.psd1)
Set-Location "$SiteCode`:"

# Get objects for bootable media
$BootImage = Get-CMBootImage -Name $BootImageName
$DP = Get-CMDistributionPoint -SiteSystemServerName $DPName
$MP = Get-CMManagementPoint -SiteSystemServerName $MPName

# Configure settings for Bootable media
$BootableMedia_Params = @{
    MediaMode             = "SiteBased"
    MediaType             = "CdDvd"
    Path                  = $ISOFile
    AllowUnknownMachine   = $true
    BootImage             = $BootImage
    DistributionPoint     = $DP
    ManagementPoint       = $MP
    AllowUnattended       = $true
    Force                 = $true
}

# Create bootable media
New-CMBootableMedia @BootableMedia_Params

New-NoPromptBootImageISO.ps1

This script creates a ConfigMgr Boot Image ISO with a No-Prompt boot behavior. It uses any existing Boot Image ISO as a source. Change lines 8-9 to match your environment.

# The script requires that you have Windows ADK for Windows 11 installed (any version)

# Requires the script to be run under an administrative account context.
#Requires -RunAsAdministrator

# Settings
$WinPE_Architecture = "amd64"
$WinPE_InputISOfile = "E:\Setup\Bootimage.iso"
$WinPE_OutputISOfile = "E:\Setup\Bootimage_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+":"

# 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',"$ISODrive\","`"$WinPE_OutputISOfile`"") -PassThru -Wait -NoNewWindow
if($Proc.ExitCode -ne 0)
{
    Throw "Failed to generate ISO with exitcode: $($Proc.ExitCode)"
}

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

Johan Arwidmark

0 0 votes
Article Rating
Subscribe
Notify of
guest
7 Comments
Newest
Oldest Most Voted
Erik Hubert
Erik Hubert
3 months ago

Hi Johan,
i have used this script to get rid off the "press any key…" this works, but the TsmBootstrap. ini is also changed and the Unattended=true is changed in Unattended=false. How can i create the iso with Unattended=true?

Best Regards,

Erik Hubert

Charles
Charles
4 months ago

Hi,
the Bootimage.iso works but the Bootimage_NoPrompt.iso did not work,
At the VM, it shows when booting:
Virtual Machine Boot Summar

1 SCSI DVD (0,0) The boot loader failed – Access denied

Even if I turned off the secure boot, same behavior

Charles
Charles
4 months ago

after updating to Windows ADK for Windows 11, it worked. Thank you

Brad
Brad
1 year ago

Hi Johan, I love your stuff. Tell me is there a way I can configure powershell connections remotely to use the CM powershell cmdlets? I've not been successfull doing that and seem to only be able to run the CM cmdlets when I launch the powershell session connected to the admin console on the site server…


>