Apply Windows Image using DISM Instead of Clean Install  

Page 3 of 3 FirstFirst 123

  1. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #20

    AuraticTrance said:
    Is it possible to change the drive ID from C: to any other letter after Windows boots ? for the case when applying the image to a VHD ?
    Quote from Ten Forums video thread:

    Kari said:
    New video: Dual Boot - The Easy Way



    The easiest possible method to dual boot. No partitioning, no virtualization required. Deploy Windows 10 on a virtual hard disk VHD or VHDX file, add it to boot menu. When done, when you no longer want to dual boot, just delete the VHD file.

    The DISKPART script and deployment batch from video:

    DISKPART scripts are normal text files with extension .txt. To run a DISKPART script, enter following command:

    diskpart /s DRIVE:\FOLDER\SCRIPT.TXT

    Here's the script used in video:
    Code:
    create vdisk file=F:\W10PRO.vhdx maximum=51200 type=expandable
    attach vdisk
    create part primary
    format quick label="Windows"
    assign letter=W
    exit
    Save script as VHDConfig.txt

    Above script creates a dynamically expanding 50 GB (51,200 MB) VHDX file (you can use .vhd or .vhdx) named W10PRO.vhdx in root of drive F:, labels it Windows and assigns it a temporary drive letter W:. Edit script to meet your needs, be sure the drive you create VHD has double the free storage than the size of VHD; if you will create a 100 GB VHD file to be used in dual boot, the drive where it will be created needs 200 GB free.

    Also, be sure to assign an unused drive letter! I always use W: which I have reserved for this purpose, never assigning it to anything else. In any case the drive letter will only be needed for deployment, it will be freed when VHD will be unmounted.

    The deployment batch is really simple, too. It just runs DISKPART script to set up VHD, deploys Windows on it with DISM, adds it to host boot menu and finally changes the boot menu entry to something more descriptive:
    Code:
    start /wait diskpart /s E:\Users\Kari\Scripts\VHDConf.txt
    start /wait dism /apply-image /imagefile:I:\sources\install.wim /index:8 /applydir:W:\
    start /wait bcdboot W:\Windows
    start /wait bcdedit /set {default} description "W10 PRO EN-GB (VHD)"
    cls
    @echo off
    echo. 
    echo Windows deployed to VHD file
    echo and added to host boot menu.
    echo.
    pause
    exit
    Save batch file as VHDBoot.bat

    Again, edit the batch to meet your needs. Be sure path to DISKPART script is correct, and that path to install.wim (or in case of MCT ISO install.esd) is correct in DISM command. Select correct index value. Check that BCDBOOT will add Windows to boot menu from correct disk, the drive letter here must be the same DISKPART script assigned to VHD.

     Windows 10 ISO edition index values


    Table 1: Official Windows 10 ISO images

    Edition index values for ISO images downloaded from Download Windows 10 Disc Image (ISO File)

    • ESD = ISO image created with Windows Media Creation Tool (install.esd file instead of install.wim)
    • WIM = WIM based ISO image (requires browser user agent change)


    Notice that values in WIM column also apply for official Insider ISO images downloaded from Download Windows 10 Insider Preview Advanced

    Edition ESD WIM
    Home 1 1
    Home N 2 2
    Home SL 3 3
    Pro 6 6
    Pro N 7 7
    Pro Education - 8
    Pro Education N - 9
    Pro for Workstation - 10
    Pro for Workstation N - 11
    Education 4 4
    Education N 5 5


    Table 2: Visual Studio (former MSDN) subscriber ISO images

    Edition index values for ISO images downloaded from Sign in to your account
    • VSB= Business editions ISO image
    • VSC= Consumer editions ISO image


    Edition VSB VSC
    Home - 1
    Home N - 2
    Home SL - 3
    Pro 5 6
    Pro N 6 7
    Pro Education 7 8
    Pro Education N 8 9
    Pro for Workstation 9 10
    Pro for Workstation N 10 11
    Education 1 4
    Education N 2 5
    Enterprise 3 -
    Enterprise N 4 -
    Enterprise for Virtual Desktops 11 -


    All single edition ISO images have index value 1 for edition in question regardless of edition, for instance whatever edition you are running, its index = 1 if you made the ISO by yourself with UUPtoISO.


    Kari
      My Computer


  2. Posts : 56
    Windows 10 Pro 1903
       #21

    When i boot into a VHD, the drive letter of the VHD which was previously assigned X: (say) during creation, changes to C: and the default OS drive which is C: originally changes to D: and becomes in-accessible and shows the pop up message to format before use, also a CHKDSK is automatically performed on D: (originally C:) when windows is loading from VHD (at the rolling dots screen). Don't know why this is happening ? Although this happened only during the first time when booting into the VHD.

    When i boot back to my default OS on HDD, everything's fine.
      My Computer


  3. Posts : 4,143
    Windows 3.1 to Windows 11
       #22

    The Booted OS will Always be C
    The letter assignment is for Mounting the VHD in the OS
      My Computer


  4. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #23

    Kyhi said:
    The Booted OS will Always be C
    The letter assignment is for Mounting the VHD in the OS
    Exactly.

    Whatever Window OS you select from boot menu, it's always going to b drive C: and other operating systems, their drive letters, changed accordingly.

    Kari
      My Computer


  5. Posts : 56
    Windows 10 Pro 1903
       #24

    WinNTSetup has an option called "Mount installation drive as: ", i tried applying a Windows 7 image to a VHD and booted into it and the drive letter of the OS drive was successfully changed but C: was still in-accessible.
      My Computer


  6. Posts : 1
    Server 2016
       #25

    Kari, you are the man!

    I've gone from a dodgy old Windows XP laptop (running a mission critical app with no easy replacement) to XP on a hyper v vm, to vista, to sp1, to sp2, to Win 7 and then to Win 10.
    Fine but the app needs to be on hardware. And new hardware ideally.

    This fixed my issue, genius, absolute genius,
      My Computer


  7. Posts : 138
    Windows 10
       #26

    Hey @Kari,
    Can you run the bcdboot command without referring to the "G:\Windows\System32" part?
    So instead of
    Code:
    X:\Sources>G:\Windows\System32\bcdboot G:\Windows
    We did...
    Code:
    X:\Sources>bcdboot G:\Windows
    I guess my question is does the Win10 USB installer contain the "bcdboot" execution file by itself? And would this method cause any issues?
      My Computer


  8. Posts : 1
    macOS
       #27

    KabyBlue said:
    Hey @Kari,
    Can you run the bcdboot command without referring to the "G:\Windows\System32" part?
    So instead of
    Code:
    X:\Sources>G:\Windows\System32\bcdboot G:\Windows
    We did...
    Code:
    X:\Sources>bcdboot G:\Windows
    I guess my question is does the Win10 USB installer contain the "bcdboot" execution file by itself? And would this method cause any issues?
    i've seen both ways work. i've tried both and each attempt gives me "Failure when attempting to copy boot files."

    also, when i run `DIR G:` i only get 5 Dir(s) instead of the 6 in the tutorial. i am missing "assembly"
    Last edited by patto; 27 May 2022 at 10:39.
      My Computer


 

Tutorial Categories

Apply Windows Image using DISM Instead of Clean Install 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 05:17.
Find Us




Windows 10 Forums