Apply unattended answer file to Windows 10 install media  

Page 2 of 3 FirstFirst 123 LastLast

  1. Posts : 2
    windows 10
       #10

    Question: I'm using ISO as starting point. An ISO with .esd file.
    I obiously created a .wim
    I created autounattended.xml using official adk tool.
    After committing changes to my .wim file, how can I add to the starting ISO, replacing the .esd file ?
      My Computer


  2. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #11

    realtebo said:
    After committing changes to my .wim file, how can I add to the starting ISO, replacing the .esd file ?
    See Part Five in this tutorial: Create Windows 10 ISO image from Existing Installation

    Kari
      My Computer


  3. Posts : 2
    windows 10
       #12

    Kari said:
    See Part Five in this tutorial: Create Windows 10 ISO image from Existing Installation

    Kari
    The pointed part requires a folder with all files to add to iso.
    Can I suppose to simply replace starting .esd file with my .wim file?
    And then, which name must have the file with answers? unattend.xml or autounattend.xml ? I've generated using Windows System Image Manager
      My Computer


  4. Posts : 1,775
    Windows 10 Pro
       #13

    Not-newbie but new to unattended installs questions


    So I have to do a 1903 update for all the systems in my home LAN, and I've put that off because of all the time it takes babysitting each install. The unattended XML approach seems attractive.

    Here are my questions. If these questions show that I'm not understanding key parts of the unattended install process, Your Honor I plead Guilty As Charged.


    • Can I create just one unattended.xml file that would prompt me for system-specific info like system name but would answer all the questions about timezone, keyboard, language, etc. All systems are 64 bit, and all but 1 are PRO. That other 1 is HOME (but I'm seriously thinking about upgrading to PRO.
    • All these installs are updates, but when I read through this thread and others, they perform new installs where they wipe the drive clean. Can I do an update install with unattended.xml?
      My Computers


  5. Posts : 1
    WINDOWS 10 PRO
       #14

    Thank you so much !!!!


    I have spent the who last week trying to figure this out and you just had it here. thank you so much made me an all star at my work.
      My Computer


  6. Posts : 83
    Windows 10 Pro
       #15

    Hello,

    Is it possible to create an unattended file that will apply 2 msu files and one cab file durning install?

    Cheers
      My Computer


  7. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #16

    Danielx64 said:
    Is it possible to create an unattended file that will apply 2 msu files and one cab file durning install?
    You should add MSU and CAB packages to WIM image after image has been customized, sysprepped and captured. Please see this Microsoft Docs support article: https://docs.microsoft.com/en-us/win...ws-updates-sxs

    I've written a PowerShell script to do it: PowerShell Scripting - Update Windows 10 USB install media

    Kari
      My Computer


  8. Posts : 3
    W10
       #17

    What brought me to this tutorial is that this one discusses using unattend.xml in the panther folder and that's the method I'm having problems with.

    I'm trying to follow the instructions on https://docs.microsoft.com/en-us/win...sktop-editions to deploy an OEM customized Windows 10 Pro image but it's not working right.

    I found your guide here in hopes for a solution. The Microsoft guide indicates extracting image index 1 (Windows 10 Home) but I need index 6 (Windows 10 Pro), so I extract index 6 to start. But no matter what I do, WINVER reports Windows 10 Enterprise, not Pro.

    I have verified the extracted basicimage.wim is Windows 10 Pro using "Dism /Get-ImageInfo" and verified the mounted image is Windows 10 Pro using "Dism /Get-CurrentEdition" and the customized install.wim file with my added drivers and customizations is Windows 10 Pro using "Dism /Get-ImageInfo". I've tried many variations of the default Windows 10 product keys specified in unattend.xml phase 1 and/or 4. I've tried both the default keys; the one beginning with VK7JG- and the key beginning with RHGJR-. I've even tried with no product key at all. The unattend.xml file is set to boot into audit mode. I've even tried using "Dism /Set-Edition:Professional".

    I've tried a source image comes from an official Windows 10 Professional 1909 OEM DVD I purchased on Amazon (which has an install.esd file). And I've also tried an Windows 10 Professional 2004 ISO provided by my Microsoft Action Pack Subscription (which has an install.wim file).

    The unattend.xml file passes validation. I'm trying to do the minimum necessary things in unattend.xml at this point until I successfully get a Windows 10 Pro installation, so I'm no using any locale options or user account settings. I'm not using any partition information in the unattend.xml file since I am using the diskpart scripts specified in the Microsoft guide so that the recovery partition is at the end of the disk. Here is the (current iteration) of the unattend.xml file:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="specialize">
            <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <OEMInformation>
                    <Manufacturer>MFG</Manufacturer>
                    <SupportHours>08:30 - 16:30</SupportHours>
                    <SupportPhone>+1 (555) 555-2222</SupportPhone>
                    <SupportURL>http://www.mydomain.com</SupportURL>
                    <Model>Model</Model>
                    <Logo>%windir%\system32\OEM\Logo.bmp</Logo>
                </OEMInformation>
                <CopyProfile>true</CopyProfile>
            </component>
        </settings>
        <settings pass="windowsPE">
            <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <UserData>
                    <ProductKey>
                        <Key>VK7JG-NPHTM-C97JM-9MPGT-3V66T</Key>
                        <WillShowUI>OnError</WillShowUI>
                    </ProductKey>
                    <AcceptEula>true</AcceptEula>
                    <Organization>Organization</Organization>
                </UserData>
            </component>
        </settings>
        <settings pass="oobeSystem">
            <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <OOBE>
                    <HideEULAPage>true</HideEULAPage>
                    <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
                    <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
                    <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                    <ProtectYourPC>3</ProtectYourPC>
                    <UnattendEnableRetailDemo>false</UnattendEnableRetailDemo>
                </OOBE>
            </component>
        </settings>
        <cpi:offlineImage cpi:source="wim://3rs8532/cmodel1/source/install.wim#Windows 10 Pro" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
    </unattend>
    Because I've now had to remake the image over a dozen times to try various unattend.xml and source image combinations, I've written a script that automates creating the custom install.wim file. Here is that make.cmd file:

    Code:
    @echo off
    If "%model%" == "" Set model=%cd%
    
    rem Set this to the source index for Windows 10 Pro within the ISO's install.wim or install.esd file.
    rem When specifying an install esd file you may need to use windows_source_compress or the extraction may fail.
    set windows_source=%model%\source\install.wim
    set windows_source_index=6
    rem set windows_source_compress=/Compress:max
    
    rem If preinstall_drivers using offline services is set to Y then all drivers with INF files in the Drivers folder will be preinstalled into the running image using Dism Add-Driver /Recurse.
    set preinstall_drivers=N
    
    if "%1" == "clean" goto CLEAN
    if "%1" == "build" goto BUILD
    if "%1" == "install" goto INSTALL
    if "%1" == "help" goto HELP
    
    echo USAGE
    echo.
    echo %0 parameter [ CLEAN ^| BUILD ^| INSTALL ^| HELP ]
    echo.
    GOTO END
    
    :HELP
    echo ** * * ALERT: You must run this script from Deployment and imaging tools environment started in Administrator mode
    echo.
    echo Prepare your technician PC:
    echo.
    echo 1. Install Windows Assessment and Deployment Kit (Windows ADK)
    echo    https://go.microsoft.com/fwlink/?linkid=2120254
    echo.
    echo 2. Install Windows PE Add-On
    echo    https://go.microsoft.com/fwlink/?linkid=2120253
    echo.
    echo 3. Create a working folder for this model with subfolders as follows.
    echo.   If the working folder for this model is C:\model1\ you will have the following folder tree:
    echo.
    echo.     C:\model1\		- Place this make file here.
    echo.     C:\model1\Source\	- Place the original install.wim file here.
    echo.     C:\model1\Source\	- Also place your custom unattend.xml file here.
    echo.     C:\model1\Logos\	- Place your OEM 120x120 pixel logo.bmp and logo.png file here.
    echo.     C:\model1\Drivers\	- Place all model specific drivers here.
    echo.     C:\model1\USB-B\	- Extract the contents of the USB-B-1803.ZIP here.
    echo.
    echo      NOTE: USB-B-1803.ZIP can be found at https://go.microsoft.com/fwlink/?linkid=872894
    echo.
    echo NOTE: The Windows ADK version must match the Windows source version. i.e. If The Windows source is version 2004, then the Windows ADK must also be for version 2004.
    echo Also, CD to the root folder of hte model before running this command.
    GOTO END
    
    :BUILD
    echo *****************************************
    echo ** Checking for required files         **
    echo *****************************************
    if not exist "%windows_source%" (
      echo FILE NOT FOUND ERROR: "%windows_source%"
      echo Edit this script and change the ^%windows_source^% setting
      GOTO HELPNEXT
    )
    if not exist "%model%\Source\Unattend.xml" (
      Echo FILE NOT FOUND ERROR: "%model%\Source\Unattend.xml"
      GOTO HELPNEXT
    )
    if not exist "%model%\Logos\logo.*" (
      Echo FILE NOT FOUND ERROR: "%model%\Logos\logo.*"
      GOTO HELPNEXT
    )
    echo OK
    GOTO BUILDNEXT
    
    :HELPNEXT
    GOTO HELP
    
    :BUILDNEXT
    echo *****************************************
    echo ** Prepare WinPE image                 **
    echo *****************************************
    
    echo ** Prepare WinPE files
    call copype amd64 "%model%\winpe_amd64"
    
    echo ** Mount your WinPE image
    if not exist "%model%\winpe_amd64\mount" md "%model%\winpe_amd64\mount"
    Dism /mount-image /imagefile:"%model%\WinPE_amd64\media\sources\boot.wim" /index:1 /mountdir:"%model%\winpe_amd64\mount"
    if errorlevel 1 goto ERROR
    
    echo ** Add drivers to WinPE (If needed).
    rem Not needed for this model
    
    echo ** Set the power scheme to high-performance
    echo powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c >> "%model%\Winpe_amd64\mount\windows\system32\startnet.cmd"
    
    echo ** Cleanup your WinPE image
    Dism /image:"%model%\winpe_amd64\mount" /Cleanup-image /StartComponentCleanup
    if errorlevel 1 goto ERROR
    
    echo ** Commit your changes and unmount your image
    Dism /unmount-image /mountdir:"%model%\winpe_amd64\mount" /commit
    if errorlevel 1 goto ERROR
    if exist "%model%\winpe_amd64\media\sources\boot2.wim" del "%model%\winpe_amd64\media\sources\boot2.wim"
    Dism /export-image /sourceimagefile:"%model%\winpe_amd64\media\sources\boot.wim" /sourceindex:1 /DestinationImageFile:"%model%\winpe_amd64\mount\boot2.wim"
    if errorlevel 1 goto ERROR
    del "%model%\winpe_amd64\media\sources\boot.wim" /q
    copy /y "%model%\winpe_amd64\mount\boot2.wim" "%model%\winpe_amd64\media\sources\boot.wim"
    
    echo *****************************************
    echo ** Customize your Windows image        **
    echo *****************************************
    
    md "%model%\images"
    
    echo ** Extract image
    Dism /Get-ImageInfo /imagefile:"%windows_source%"
    if errorlevel 1 goto ERROR
    Dism /export-image /sourceimagefile:"%windows_source%" /sourceindex:%windows_source_index% /destinationimagefile:"%model%\images\basicimage.wim" %windows_source_compress% /CheckIntegrity
    if errorlevel 1 goto ERROR
    if not exist "%model%\images\basicimage.wim" goto ERROR
    
    echo ** Verify image edition
    Dism /Get-ImageInfo /ImageFile:"%model%\images\basicimage.wim"
    if errorlevel 1 goto ERROR
    echo ALERT: Verify that the image is for Windows 10 Pro
    
    echo ** Mount the Windows image
    Md "%model%\mount"
    Md "%model%\mount\windows"
    Dism /Mount-Wim /WimFile:"%model%\images\basicimage.wim" /index:1 /MountDir:"%model%\mount\windows"
    if errorlevel 1 goto ERROR
    if not exist "%model%\mount\windows\windows\*" goto ERROR
    
    echo ** Verify the Windows edition
    Dism /Get-CurrentEdition /Image:"%model%\mount\windows"
    if errorlevel 1 goto ERROR
    echo ALERT: Verify that the image is for Windows 10 Pro
    
    echo ** Mount your WinRE image
    Md "%model%\mount\winre"
    Dism /Mount-Wim /WimFile:"%model%\mount\windows\Windows\System32\Recovery\winre.wim" /index:1 /MountDir:"%model%\mount\winre"
    if errorlevel 1 goto ERROR
    
    echo ** Add drivers to your Windows image
    If "%preinstall_drivers%"=="Y" Dism /Add-Driver /Image:"%model%\mount\windows" /Driver:"%model%\drivers" /Recurse
    XCopy /s /e /y /q "%model%\Drivers\*" "%model%\mount\windows\drivers\"
    
    echo ** Add drivers to your WinRE image
    If "%preinstall_drivers%"=="Y" Dism /Add-Driver /Image:"%model%\mount\winre" /Driver:"%model%\drivers" /Recurse
    
    rem echo ** Set the Windows edition
    rem Dism /Set-Edition:Professional /Image:"%model%\mount\windows"
    rem if errorlevel 1 goto ERROR
    rem echo ALERT: Verify that the image is for Windows 10 Pro
    
    echo ** Add additional customizations
    if exist "%model%\customize.cmd" call "%model%\customize.cmd"
    
    echo ** Make an answer file using Windows System Image Manager (WSIM).
    if not exist "%model%\mount\windows\Windows\panther" md "%model%\mount\windows\Windows\panther"
    copy /y "%model%\Source\Unattend.xml" "%model%\Mount\Windows\Windows\Panther"
    if not exist "%model%\Mount\Windows\Windows\System32\OEM" md "%model%\Mount\Windows\Windows\System32\OEM"
    copy /y "%model%\Logos\logo.*" "%model%\Mount\Windows\Windows\System32\OEM"
    
    echo ** Keep Windows settings through a recovery
    md "%model%\Mount\Windows\Recovery\OEM"
    copy /y "%model%\Source\Unattend.xml" "%model%\Mount\Windows\Recovery\OEM"
    xcopy /s /e /y "%model%\Mount\Windows\Sytem32\OOBE\*" "%model%\Mount\Windows\Recovery\OEM\OOBE\"
    copy /y "%model%\USB-B\Recovery\RecoveryImage\ResetConfig.xml" "%model%\Mount\Windows\Recovery\OEM"
    copy /y "%model%\USB-B\Recovery\RecoveryImage\EnableCustomizations.cmd" "%model%\Mount\Windows\Recovery\OEM"
    
    echo ** Prepare the ScanState tool
    xcopy /E /Y /Q "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\User State Migration Tool\amd64" "%model%\USB-B\ScanState_amd64"
    xcopy /E /Y /Q "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Setup\amd64\Sources" "%model%\USB-B\ScanState_amd64"
    
    echo ** Optimize WinRE (part 1)
    Dism /image:"%model%\mount\winre" /set-scratchspace:512
    if errorlevel 1 goto ERROR
    Dism /image:"%model%\mount\winre" /Cleanup-Image /StartComponentCleanup /ResetBase
    if errorlevel 1 goto ERROR
    
    echo ** Unmount your images
    Dism /Unmount-Image /MountDir:"%model%\mount\winre" /Commit
    if errorlevel 1 goto ERROR
    attrib -h -a -s "%model%\mount\windows\windows\system32\recovery\winre.wim"
    Dism /export-image /sourceimagefile:"%model%\mount\windows\windows\system32\recovery\winre.wim" /sourceindex:1 /DestinationImageFile:"%model%\images\winre_bak.wim"
    if errorlevel 1 goto ERROR
    Del "%model%\mount\windows\windows\system32\recovery\winre.wim"
    Copy /y "%model%\images\winre_bak.wim" "%model%\mount\windows\windows\system32\recovery\winre.wim"
    Dism /Image:"%model%\mount\windows" /Cleanup-Image /StartComponentCleanup
    if errorlevel 1 goto ERROR
    Dism /Unmount-Image /MountDir:"%model%\mount\windows" /Commit
    if errorlevel 1 goto ERROR
    Dism /Export-Image /SourceImageFile:"%model%\Images\basicimage.wim" /SourceIndex:1 /DestinationImageFile:"%model%\Images\install.wim"
    if errorlevel 1 goto ERROR
    
    Dism /Get-ImageInfo /imagefile:"%model%\Images\install.wim"
    if errorlevel 1 goto ERROR
    
    Dir "%model%\images\winre_bak.wim"
    echo * * * ALERT: Edit the following files to make sure the recovery partition is at least 1000 MB larger than the size of winre_bak.wim
    echo - "%model%\USB-B\Recovery\RecoveryImage\ResetPartitions-UEFI.txt
    echo - "%model%\USB-B\Deployment\CreatePartitions-BIOS.txt
    echo - "%model%\USB-B\Deployment\CreatePartitions-UEFI.txt
    echo - "%model%\USB-B\Deployment\CreateRecoveryPartitions-BIOS.txt
    echo - "%model%\USB-B\Deployment\CreateRecoveryPartitions-UEFI.txt
    pause
    
    GOTO END
    
    :INSTALL
    echo Prepare the USB drive as follows:
    echo.
    echo 1. Format the USB drive using the following process:
    echo.
    echo    diskpart
    echo    list disk
    echo    select [disk number]
    echo    clean
    echo    rem === Create the Windows PE partition. ===
    echo    create partition primary size=2000
    echo    format quick fs=fat32 label="WinPE"
    echo    assign letter=P
    echo    active
    echo    rem === Create a data partition. ===
    echo    create partition primary
    echo    format fs=ntfs quick label="USB-B"
    echo    assign letter=O
    echo    list vol
    echo    exit
    echo.
    echo 2. The USB drive's partitions must be mounted as P: "WinPE" and O: "USB-B".
    echo.
    pause
    
    echo *****************************************
    echo ** Prepare USB drive                   **
    echo *****************************************
    echo ** Create a bootable WinPE drive
    call MakeWinPEMedia /UFD "%model%\winpe_amd64" P:
    
    echo ** Create USB-B drive
    XCopy /s /e /y /q "%model%\USB-B\*" O:\
    copy /y "%model%\images\install.wim" O:\images
    copy /y "%model%\images\winre_bak.wim" O:\images
    
    echo Boot the target PC and enter the commands:
    echo ^> D:
    echo ^> cd Deployment
    echo ^> ApplyImage D:\Images\install.wim
    echo Select Y , Y , N and N to the prompts
    echo After complete, remove usb drive and type exit to reboot.
    echo.
    echo DONE
    GOTO END
    
    :CLEAN
    echo *****************************************
    echo ** Cleaning build files                **
    echo *****************************************
    if exist "%model%\winpe_amd64" (
      echo Cleaning "%model%\winpe_amd64"
      Dism /unmount-image /mountdir:"%model%\winpe_amd64\mount" /discard > nul
      Dism /unmount-image /mountdir:"%model%\winpe_amd64\mount" > nul
      Rmdir /s /q "%model%\winpe_amd64"
    )
    if exist "%model%\mount\winre" (
      echo Cleaning "%model%\mount\winre"
      Dism /unmount-image /mountdir:"%model%\mount\winre" /discard > nul
      Dism /unmount-image /mountdir:"%model%\mount\winre" > nul
      Rmdir /s /q "%model%\mount\winre"
    )
    if exist "%model%\mount\windows" (
      echo Cleaning "%model%\mount\windows"
      Dism /unmount-image /mountdir:"%model%\mount\windows" /discard > nul
      Dism /unmount-image /mountdir:"%model%\mount\windows" > nul
      Rmdir /s /q "%model%\mount\windows"
    )
    if exist "%model%\mount" (
      echo Cleaning "%model%\mount"
      Rmdir /s /q "%model%\mount"
    )
    if exist "%model%\images" (
      echo Cleaning "%model%\images"
      Rmdir /s /q "%model%\images"
    )
    GOTO END
    
    :ERROR
    :END
    rem Based on https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/oem-deployment-of-windows-10-for-desktop-editions
    Hopefully someone can help me identify the problem.

    - - - Updated - - -

    It figures that after 20 hours of failed attempts and then I post the question, then I start getting Win 10 Pro installations working. Sigh. I don't know what specific change resolve it, yet.
    Last edited by mjmeans; 29 Jul 2020 at 13:17.
      My Computer


  9. Posts : 100
    Windows 10 21H2/Windows 11 21H2 (22000.100)
       #18

    Dism /Mount-Image /ImageFile:X:\Sources\install.wim /Index:6 /MountDir:C:\Mount

    Again, replace the X:\ in /ImageFile switch with actual drive letter for your USB media, or path to folder containing files copied from ISO image. Also, replace the index number with index of your preferred Windows edition:

    I have an ISO image here :D: \ ISO_Files", which will be the command:

    ImageFile:X:

    Thank you so much for your help.

    Ahaaaaa I got it:

    Dism /Mount-Image /ImageFile:D:\ISO_Files\Sources /Index:1 /MountDir:C:\Mount

    Great tutorial, so long I searched, much thanks.
    Last edited by RuLich; 11 Nov 2020 at 07:56.
      My Computer


  10. Posts : 16
    windows 10
       #19

    It is great tutorial. In my case, I have a USB bootable drive, which has drive letter F.

    I have a question on the command,

    dism /Unmount-Image /MountDir:C:\Mount /Commit

    Will this command change the install.wim in my USB drive (the install.wim that I use to mount on c:\Mount?)

    Thanks in advance.
      My Computer


 

Tutorial Categories

Apply unattended answer file to Windows 10 install media Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 01:26.
Find Us




Windows 10 Forums