I can download a Windows.iso
(for Win10/11) and generate an autounattend.xml
file (here or here). I would then like to inject the autounattend.xml
(and possibly other startup files) into Windows.iso
using PowerShell (if there is an alternative stand-alone tool that does all of this without having to download the Windows Assessment and Deployment Kit (ADK), I would appreciate knowing of that tool as I have not found something like that).
So, I have to modify the Windows 10 ISO by adding the autounattend.xml
:
-
Mount the ISO: Use
Mount-DiskImage
. -
Copy the contents: Copy all of the ISO contents to a new folder on my local system.
-
Add the
autounattend.xml
file:autounattend.xml
must go to the root of this new folder. -
Create a new ISO: Finally, use a tool like
oscdimg
, from the Windows Assessment and Deployment Kit (ADK), to create a new ISO from the modified folder.
Some rough working on this in PowerShell:
# Mount the ISO
$isoPath = "path\to\Windows10.iso"
$virtualDrive = (Mount-DiskImage -ImagePath $isoPath -PassThru | Get-Volume).DriveLetter
# Copy the contents to a new folder
$destinationPath = "path\to\folder"
Copy-Item -Path "$($virtualDrive):\*" -Destination $destinationPath -Recurse
# Add the autounattend.xml file
Copy-Item -Path "path\to\autounattend.xml" -Destination $destinationPath
# Dismount the ISO
Dismount-DiskImage -ImagePath $isoPath
# Create a new ISO
& "path\to\oscdimg.exe" -m -o -u2 -udfver102 -bootdata:2#p0,e,b"$($destinationPath)\boot\etfsboot.com"#pEF,e,b"$($destinationPath)\efi\microsoft\boot\efisys.bin" $destinationPath "path\to\new\Windows10.iso"
Questions:
- Am I doing things correctly here, it’s been quite difficult to find out if this approach is correct?
- Are there any important points that I am missing?
- Can the
oscdimg.exe
step be done away with by instead using either built-in tools or PowerShell alone, or are there third party tools that simplify modification of the Windows ISO without having to install the Windows Assessment and Deployment Kit (ADK)?
(1) Correct way to run scripts in automatic unattended Windows installation …. https://community.spiceworks.com/topic/2297245-correct-way-to-run-scripts-in-automatic-unattended-windows-installation.
(2) How to Run Scripts from the Installation Media Within an autounattend …. https://superuser.com/questions/1534729/how-to-run-scripts-from-the-installation-media-within-an-autounattend-xml-file.
(3) How to create an unattended installation of Windows 10. https://www.windowscentral.com/how-create-unattended-media-do-automated-installation-windows-10.
(4) undefined. http://schemas.microsoft.com/WMIConfig/2002/State.
(5) undefined. http://www.w3.org/2001/XMLSchema-instance.
(6) undefined. https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/hh825027%28v%3dwin.10%29.
You have to determine what is correct. You have a task to perform that can be done manually or automated by a powershell script. Does the script run and do what you want it to do? I wouldn’t user a third party tool in this case which probably will not do exactly what you need.
Auto deployment of Windows is a fairly well-trodden path, and so it is likely that small tools with options like this might exist (and I personally would be happy to appraise such tools), PowerShell would be my preference as I can tailor it exactly as I need, but ideally I would like that to be done without having to download the ADK. Hopefully, those with experience of auto-deployment will probably know such methods and what the best options are.
Powershell and Windows are both Microsoft products. Powershell is written in Net/Core library. Apparently the Net/Core library doesn’t have all the features that are in the ADK and needs additional libraries. Windows have proprietary interfaces to that tunnel through the OS. If you do not want to use the ADK than looks at the source code at Github : github.com/microsoft/WindowsAppSDK