[SOLVED] Can't Remove Packages from Images

Discussion in 'Windows 10' started by slayer9450, Feb 20, 2016.

  1. slayer9450

    slayer9450 MDL Member

    Aug 3, 2015
    144
    62
    10
    #1 slayer9450, Feb 20, 2016
    Last edited by a moderator: Apr 20, 2017
    No matter what I try for some reason I can't remove any package from my Windows 10 images.

    DISM gives me Error 5. Access is denied. install_wim_tweak appears like it works, but it's really just going through the motions because no packages are actually removed.

    I don't know why this is happening. I use an administrator account and UAC is disabled.

    SOLUTION: (taken from posts 11 and 15. credit to xinso)

    Code:
    Dism /Mount-Image /ImageFile:<path to wim file> /index:<index #> /MountDir:<mount dir>
    install_wim_tweak.exe /p <mount dir> /l
    install_wim_tweak.exe /p <mount dir>
    for /d %%i in (ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-GB,es-ES,et-EE,fi-FI,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-HK,zh-TW) do (
    Dism /image:<mount dir> /remove-package ^
    /packagename:Package-A~amd64~%%i~10.0.10586.0 ^
    /packagename:Package-B~amd64~%%i~10.0.10586.0 ^
    /packagename:Package-C~amd64~%%i~10.0.10586.0)
    install_wim_tweak.exe /h /p <mount dir>
    Dism /Unmount-Image /MountDir:<mount dir> /Commit
    dism /Export-Image /SourceImageFile:<path to source wim> /SourceIndex:<source index #> /DestinationImageFile:<path to save new wim> /compress:Max /CheckIntegrity
    Remember to change the red and blue text placeholders to your own files and paths.
     
  2. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,601
    227
    60
    are you using a windows 10 system to remove packages or running a Windows 8.1 or 7 ?

    You need the Winows 10 latest DISM.exe.
     
  3. slayer9450

    slayer9450 MDL Member

    Aug 3, 2015
    144
    62
    10
  4. kuroda

    kuroda MDL Senior Member

    Aug 25, 2012
    369
    26
    10
    ..AFAIK..Dism Win seven does not work for Win 10 images....
     
  5. slayer9450

    slayer9450 MDL Member

    Aug 3, 2015
    144
    62
    10
    Win 10 DISM has worked fine for me in the past. I don't see why it should stop now. This feels more like a denial of permissions rather than a technical limitation.
     
  6. LiteOS

    LiteOS MDL Expert

    Mar 7, 2014
    1,368
    516
    60
    Which build
     
  7. slayer9450

    slayer9450 MDL Member

    Aug 3, 2015
    144
    62
    10
    Version 1151 (10586)
     
  8. LiteOS

    LiteOS MDL Expert

    Mar 7, 2014
    1,368
    516
    60
    is it clean or with updates installed? which build the update?
     
  9. slayer9450

    slayer9450 MDL Member

    Aug 3, 2015
    144
    62
    10
    It has the Media Feature Pack integrated.

    What do you mean?
     
  10. xinso

    xinso MDL Guru

    Mar 5, 2009
    3,929
    5,280
    120
    #11 xinso, Feb 22, 2016
    Last edited by a moderator: Apr 20, 2017
    How about:

    1.
    Mount or Extract Windows 10 10586 x64 ISO to X:\10586 on Host Windows 7 x64
    or
    Mount or Extract Windows 10 10586 x86 ISO to X:\10586 on Host Windows 7 x86

    2. Extract install.wim and mount target image to Y:\MOUNT with Read&Write parameter

    3. Run the script with Administrator privileges to unhide and get packages list (Packages.txt)
    Code:
    @echo off
    pushd "%~dp0"
    
    install_wim_tweak.exe /p Y:\MOUNT /l
    install_wim_tweak.exe /p Y:\MOUNT
    4. Open Packages.txt, and run Command Prompt (Admin)

    5. Run the commandline to remove target package(s)

    e.g.
    Adobe-Flash-For-Windows-Package~31bf3856ad364e35~amd64~~10.0.10586.0

    Code:
    X:\10586\sources\dism /image:Y:\MOUNT /remove-package /packagename:Adobe-Flash-For-Windows-Package~31bf3856ad364e35~amd64~~10.0.10586.0
    
    6. Run the script with Administrator privileges to hide packages
    Code:
    @echo off
    pushd "%~dp0"
    
    install_wim_tweak.exe /h /p Y:\MOUNT
    
    7. Unmount/Commit the image

    [Note]
    1. To remove a package, there is no need to remove the language package, the main package will remove it and all sub-packages automatically. But the language pack is needed if adding a package.

    2. To deal with both x64 and x86 images, use x64 dism on x64 Host, and x86 dism on x86 Host.
     
  11. slayer9450

    slayer9450 MDL Member

    Aug 3, 2015
    144
    62
    10
    #12 slayer9450, Feb 22, 2016
    Last edited: Feb 23, 2016
    (OP)
    I don't want to remove the main package, I just want to remove the language packages because there's a huge chunk of language packs I will never need.

    For example, these are all the packages for Microsoft-Media-Foundation-Package (there are more like this as well). I don't need all the language packs. I only need the en-us language pack and the main amd64 package.

    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~ar-SA~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~bg-BG~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~cs-CZ~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~da-DK~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~de-DE~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~el-GR~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~en-GB~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~en-US~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~es-ES~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~et-EE~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~fi-FI~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~fr-FR~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~he-IL~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~hr-HR~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~hu-HU~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~it-IT~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~ja-JP~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~ko-KR~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~lt-LT~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~lv-LV~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~nb-NO~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~nl-NL~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~pl-PL~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~pt-BR~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~pt-PT~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~qps-PLOCM~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~qps-PLOC~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~ro-RO~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~ru-RU~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~sk-SK~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~sl-SI~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~sr-LATN-RS~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~sv-SE~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~th-TH~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~tr-TR~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~uk-UA~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~zh-CN~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~zh-HK~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~zh-TW~10.0.10586.0
    Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~~10.0.10586.0
    How do I remove those packages?
     
  12. xinso

    xinso MDL Guru

    Mar 5, 2009
    3,929
    5,280
    120
    #13 xinso, Feb 22, 2016
    Last edited: Feb 22, 2016
    Copy and make it a script, like Remove-Unwanted-Language.cmd. Then run it as Administrator at step 5.

    for /d %%i in (ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-GB,es-ES,et-EE,fi-FI,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-HK,zh-TW) do (X:\10586\sources\dism /image:Y:\MOUNT /remove-package /packagename:Microsoft-Media-Foundation-Package~31bf3856ad364e35~amd64~%%i~10.0.10586.0)
     
  13. slayer9450

    slayer9450 MDL Member

    Aug 3, 2015
    144
    62
    10
    I will try that and report back. For the other language packs in other packages I would just copy and paste the loop, but change the package name inside, right?
     
  14. xinso

    xinso MDL Guru

    Mar 5, 2009
    3,929
    5,280
    120
    #15 xinso, Feb 23, 2016
    Last edited: Feb 23, 2016
    Yes. Or

    for /d %%i in (ar-SA,bg-BG,cs-CZ,da-DK,de-DE,el-GR,en-GB,es-ES,et-EE,fi-FI,fr-FR,he-IL,hr-HR,hu-HU,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,zh-CN,zh-HK,zh-TW) do (
    X:\10586\sources\dism /image:Y:\MOUNT /remove-package ^
    /packagename:
    Package-A~amd64~%%i~10.0.10586.0 ^
    /packagename:Package-B~amd64~%%i~10.0.10586.0 ^
    /packagename:Package-C~amd64~%%i~10.0.10586.0
    )
    pause
     
  15. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    7,395
    23,032
    240
    Providing the dism.log file would help determining the exact cause :rolleyes:

    anyway, MediaFeaturePack is a permanent package, once added it can't be removed normally
     
  16. LiteOS

    LiteOS MDL Expert

    Mar 7, 2014
    1,368
    516
    60
    get N edition maybe this package not exist
     
  17. slayer9450

    slayer9450 MDL Member

    Aug 3, 2015
    144
    62
    10
    #18 slayer9450, Feb 23, 2016
    Last edited: Feb 23, 2016
    (OP)
    Not needed. xinso's solution worked. The packages got removed according to the Packages.txt generated by install_wim_tweak.

    It doesn't matter to me that the MFP is a permanent package. Normally I'd be being using the standard Enterprise version, but that version downloads apps like Candy Crush, Twitter, etc. after the OOBE is complete. The N version does not and that's why I'm using it.

    The most interesting thing to come out this (I think) is that removing language packs actually added 60,766 extra kilobytes to the install.wim file size

    And @xinso: I've thanks'd the two posts that helped me.
     
  18. xinso

    xinso MDL Guru

    Mar 5, 2009
    3,929
    5,280
    120
    #19 xinso, Feb 23, 2016
    Last edited by a moderator: Apr 20, 2017
    Feedback@Get-Rid-of-5-Non-Default-Apps (CandyCrushSodaSaga, Twitter...)

    Use the 46 KB DefaultLayouts.xml

    of \Users\Default\AppData\Local\Microsoft\Windows\Shell for 10240 Enterprise LTSB

    instead of the 98 KB DefaultLayouts.xml for Non-LTSB editions

    Or the one for N versions.

    Export it to a new file.
    Code:
    dism /Export-Image /SourceImageFile:X:\old.wim /SourceIndex:1 /DestinationImageFile:X:\new.wim /compress:Max /CheckIntegrity
     
  19. slayer9450

    slayer9450 MDL Member

    Aug 3, 2015
    144
    62
    10
    Okay. So just copy the .xml from that path on the LTSB version to the same on Enterprise and it won't download the bloatware?

    The extra ~60 MB was after rebuilding the image with max compression. That's why I thought it was interesting.