DISM install.wim correct order

Discussion in 'Windows 10' started by polililil, Dec 31, 2018.

  1. polililil

    polililil MDL Novice

    Apr 10, 2014
    23
    2
    0
    I know there is already and "Customisation Thread of windows 10", but recently I used DISM to modify my image. First, I dont want to use any 3rd party app like Toolkit or NTLite or anything like that, if someone is trying to to advertise it.

    Is this the correct Order:
    1. Integrating Updates (service stack first, later the other updates in the release order)
    -> ResetBase
    2. Disable Features (like Internet Explorer)
    -> ResetBase
    3. Enable Features
    -> ResetBase
    4. Remove Packages
    -> ResetBase


    Example of an .bat file in this order, pls if someone has knowledge can check it if it is done properly
    Code:
    /Delete-Image /ImageFile:C:\en_windows_10_enterprise_ltsc_2019_x64_dvd_74865958\sources\install.wim /Index:1 /CheckIntegrity
    Dism /Mount-Image /ImageFile:C:\en_windows_10_enterprise_ltsc_2019_x64_dvd_74865958\sources\install.wim /Index:1 /MountDir:C:\Wim
    Dism /Image:C:\Wim /Add-Package /PackagePath:C:\Users\user01\Desktop\Updates\10.0.1809.x64\windows10.0-kb4470788-x64_76f112f2b02b1716cdc0cab6c40f73764759cb0d.msu
    Dism /Image:C:\Wim /Add-Package /PackagePath:C:\Users\user01\Desktop\Updates\10.0.1809.x64\windows10.0-kb4465065-x64_49ec576e48947f860ee16278e7efe8cded0c49d7.msu
    Dism /Image:C:\Wim /Add-Package /PackagePath:C:\Users\user01\Desktop\Updates\10.0.1809.x64\windows10.0-kb4470502-x64_929d86d25557a4f92b7643111dab4b7d1ae87808.msu
    Dism /Image:C:\Wim /Add-Package /PackagePath:C:\Users\user01\Desktop\Updates\10.0.1809.x64\windows10.0-kb4471331-x64_f40a66c873644c2b88ed389882364a8d1fc52328.msu
    Dism /Image:C:\Wim /Add-Package /PackagePath:C:\Users\user01\Desktop\Updates\10.0.1809.x64\windows10.0-kb4483235-x64_9d25f46d4a9da7dd295f8a6412a64eca9de4ed82.msu
    Dism /Image:C:\Wim /Cleanup-Image /StartComponentCleanup /ResetBase
    Dism /Unmount-Image /MountDir:C:\Wim /Commit /CheckIntegrity
    Dism /Mount-Image /ImageFile:C:\en_windows_10_enterprise_ltsc_2019_x64_dvd_74865958\sources\install.wim /Index:1 /MountDir:C:\Wim
    Dism /Image:C:\Wim /Disable-Feature /FeatureName:SearchEngine-Client-Package /Remove
    Dism /Image:C:\Wim /Disable-Feature /FeatureName:Internet-Explorer-Optional-amd64 /Remove
    Dism /Image:C:\Wim /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux
    Dism /Image:C:\Wim /Enable-Feature /FeatureName:Client-DeviceLockdown
    Dism /Image:C:\Wim /Enable-Feature /FeatureName:Client-EmbeddedShellLauncher
    Dism /Image:C:\Wim /Enable-Feature /FeatureName:Client-KeyboardFilter
    Dism /Image:C:\Wim /Enable-Feature /FeatureName:Client-UnifiedWriteFilter
    Dism /Image:C:\Wim /Cleanup-Image /StartComponentCleanup /ResetBase
    Dism /Unmount-Image /MountDir:C:\Wim /Commit /CheckIntegrity
    Dism /Mount-Image /ImageFile:C:\en_windows_10_enterprise_ltsc_2019_x64_dvd_74865958\sources\install.wim /Index:1 /MountDir:C:\Wim
    Dism /Image:C:\Wim /Remove-Package /PackageName:Microsoft-Windows-Hello-Face-Migration-Package~31bf3856ad364e35~amd64~~10.0.17763.1
    Dism /Image:C:\Wim /Remove-Package /PackageName:Microsoft-Windows-Hello-Face-Package~31bf3856ad364e35~amd64~~10.0.17763.1
    Dism /Image:C:\Wim /Remove-Package /PackageName:Microsoft-Windows-InternetExplorer-Optional-Package~31bf3856ad364e35~amd64~~11.0.17763.1
    Dism /Image:C:\Wim /Cleanup-Image /StartComponentCleanup /ResetBase
    Dism /Unmount-Image /MountDir:C:\Wim /Commit /CheckIntegrity
    PAUSE
     
  2. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,274
    94,763
    450
    Afaik, there is no need for all the /resetbase command, one at the end should be enough.

    Be aware it breaks some windows functionality, but chopping will do that anyway:D
     
  3. polililil

    polililil MDL Novice

    Apr 10, 2014
    23
    2
    0
    What do you mean by chopping? Which functionality breaks? Do you referring to /ResetBase by breaking something?
     
  4. Krager

    Krager MDL Senior Member

    Jan 9, 2017
    396
    233
    10
    chopping = /Remove-Package

    When you start removing components that are not normally absent from the stock image you can get some side-effects since they don't test to make sure Windows runs fine without them. That's not to say you shouldn't do it, just there may or may not be things that don't work right. There's ton of stuff I'd like to remove from my images, but may have to disable instead if it causes too many problems. It's something I'm working on right now.

    Yeah you don't want to run that /StartComponentCleanup /ResetBase any more than you have to, It takes a while to process. Once at then end before dismounting the image should be good. Otherwise I don't think it will hurt anything if you run it more than once.
     
  5. Ace2

    Ace2 MDL Expert

    Oct 10, 2014
    1,414
    1,193
    60
    Dism and /ResetBase will break nothing, because Dism is the proper way to modify an image,;)
     
  6. Krager

    Krager MDL Senior Member

    Jan 9, 2017
    396
    233
    10
    Oh there is one caveat with that /ResetBase command I ran into myself. It will fail to run with a complaint about pending actions out if you add dotnet 3.5 to the image. You have to run the /ResetBase then add dotnet 3.5. Though I don't see you adding that so it should not be a concern.
     
  7. Ace2

    Ace2 MDL Expert

    Oct 10, 2014
    1,414
    1,193
    60
    When using dism make sure to learn, how to do things in the right order.:p
     
  8. Ace2

    Ace2 MDL Expert

    Oct 10, 2014
    1,414
    1,193
    60
     
  9. ricktendo64

    ricktendo64 MDL Expert

    Apr 20, 2008
    1,397
    2,024
    60
    Tip# 1: Put all updates in a single folder and use this as PackagePath and dism will parse and install all updates in that folder

    Code:
    dism /Image:C:\Wim /Add-Package /PackagePath:<path_to_folder_with_updates>
    Tip# 2: Save time by issuing the Enable/Disable-Feature command in a single line

    Code:
    dism /Image:C:\Wim /Disable-Feature /FeatureName:SearchEngine-Client-Package /FeatureName:Internet-Explorer-Optional-amd64 /Remove
    Dism /Image:C:\Wim /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /FeatureName:Client-DeviceLockdown /FeatureName:Client-EmbeddedShellLauncher /FeatureName:Client-KeyboardFilter /FeatureName:Client-UnifiedWriteFilter
     
  10. polililil

    polililil MDL Novice

    Apr 10, 2014
    23
    2
    0
    #10 polililil, Jan 1, 2019
    Last edited: Jan 1, 2019
    (OP)
    Thank you all for the HELP. I have some remaining questions.

    If I want to add:
    Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~amd64~~.cab
    does I also need to add
    Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~amd64~en-US~.cab
    on an en-US system?

    Is this also the correct order:
    First the normal package, than the English-US specific packages?
    @chblock mentioned I need to add ResetBase before integrating these two packages (add-packages) and afterwards?
    Does I need to integrate the "Service Stack-Update" before these two packages?

    Lastly, I discovered in and VM if I enable features after integrating updates the last Commutative Update gets reinstalled by windows update. So is enabling Features preferred to do before integrating updates (how does it affect disabling features or remove packages? That quit confusing because NTLIte does the Feature task after integrating updates.

    So maybe overall this is the cleanest order?
    1. Enable Features
    2. Integrate OnDemand Packages
    3. Integrate Updates (Service Stack first, later the updates in release order)
    4. Disable Features
    5. Remove Packages
     
  11. Krager

    Krager MDL Senior Member

    Jan 9, 2017
    396
    233
    10
    #13 Krager, Jan 1, 2019
    Last edited: Jan 1, 2019
    I'm not using the /LimitAccess switch on that command. What effect does it have?

    Edit: Oh, nevermind, I just looked it up, tells dism not to contact Windows Update to get images, moot for me since I have Windows Update turned off from the registry and I'm usually offline when building images anyway.
     
  12. Krager

    Krager MDL Senior Member

    Jan 9, 2017
    396
    233
    10
    Just use the command as shown, as far as I know (but not sure) all the iso files have the NetFx3 package in the .\sources\sxs directory. I'm using LTSC 2019 and it's there. You have to mount the iso first of course. Just mount it before you run the script, that's what I do.
     
  13. polililil

    polililil MDL Novice

    Apr 10, 2014
    23
    2
    0
    You were right thank you very much!
     
  14. polililil

    polililil MDL Novice

    Apr 10, 2014
    23
    2
    0
    Okay after Using Dism /Image:C:\Wim /Enable-Feature /FeatureName:NetFx3 /All /Source:<path_to_extracted_iso>\sources\sxs /LimitAccess ResetBase wont work. It says something with pending.... Does anyone know why?
     
  15. cyberloner

    cyberloner MDL Member

    Sep 19, 2009
    230
    45
    10
    i just intergrate the cab file and dotnet will be installed after finish installation....
    rem Intergrate Dotnet
    Dism /Image:Mount /Add-Package /PackagePath:microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab
    Dism /Image:Mount /Add-Package /PackagePath:Microsoft-Windows-NetFx3-OnDemand-Package~31bf3856ad364e35~amd64~en-US~.cab
     
  16. Krager

    Krager MDL Senior Member

    Jan 9, 2017
    396
    233
    10
    Enabling the NetFx3 feature creates a pending operation. Issue the command to integrate NetFx3 after doing;
    dism /image:<path to image> /Cleanup-Image /StartComponentCleanup /ResetBase.