MSMG ToolKit

Discussion in 'MDL Projects and Applications' started by MSMG, Nov 21, 2013.

  1. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    5,392
    11,290
    180
    No for some packs with the extension .tpk when I compared the ACL for Program Files, Program Files (x86), Windows folder or files inside them where different from the original offline image.

    The untouched offline image ACL for Program Files, Program Files (x86), Windows folder is NT Security: TrustedInstaller TrustedInstaller s: d:13 424

    The ACL for these Program Files, Program Files (x86), Windows can be restored to original but for other files/folders not present in the original untouched image we need to rename files/folders present in the original untouched image to match the items, then copy the ACL, copy the new items and then replace the ACL back.

    I did re-created the games pack as I have restored some of the games which where removed earlier due to same folder permission bug.

    Will check each pack if any file/folder needs any fix and update them.

    Both 19041.1 MSDN and UUP images are clean, the refreshed images are corrupt due to duplicate folder permissions and ghost SFC errors.

     
  2. Supern00b

    Supern00b MDL Addicted

    Dec 30, 2010
    649
    420
    30
    Currently I'm using the Games pack from mega, uploaded 14 august 2019. If there is a newer version maybe you haven't uploaded it yet.
    So I'll just wait until you check and update the packs, thanks again for your dedication.

    Cheers.
     
  3. kusosaito

    kusosaito MDL Novice

    Nov 14, 2018
    47
    3
    0
    hi, can you tell me how can i import in image drivers from newlest versions of win?
    i use LTSC, and i dont want to put inside all garbage updates, i want only new drivers (win/INF ; win/sys32/driver)
    where can i DL it for my LTSCx64-10.0.17763-JP?
    thank you
     
  4. RaiyvaN

    RaiyvaN MDL Senior Member

    Sep 23, 2009
    277
    317
    10
    Step 01: To provisionally fix this in the script, go to the IntDedup section and replace from this:
    Code:
    :: Setting Package Service Pack Build
    if "%SelectedSourceOS%" equ "w10" (
       if "%ImageBuild%" equ "10586" set "PackageServicePackBuild=0"
       if "%ImageBuild%" equ "14393" set "PackageServicePackBuild=0"
       if "%ImageBuild%" equ "15063" set "PackageServicePackBuild=0"
       if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
       if "%ImageBuild%" equ "17134" set "PackageServicePackBuild=1"
       if "%ImageBuild%" equ "17763" set "PackageServicePackBuild=1"
       if "%ImageBuild%" equ "18362" set "PackageServicePackBuild=1"
       if "%ImageBuild%" equ "18363" set "PackageServicePackBuild=1"
       if "%ImageBuild%" equ "19041" set "PackageServicePackBuild=1"
       if "%ImageBuild%" equ "19042" set "PackageServicePackBuild=1"
       if "%ImageBuild%" equ "19043" set "PackageServicePackBuild=1"
    )
    
    to

    Code:
    if "%ImageVersion:~0,-6%" equ "10.0" (
       if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "19043" (
           :: Get updated Image Information
           call :GetUpdatedImageInformation
       ) >nul
       :: Setting Package Build and Service Pack Build Version
       if "%ImageBuild%" leq "17763" set "PackageBuild=%ImageBuild%"
       if "%ImageBuild%" geq "18362" if "%ImageBuild%" leq "18363" set "PackageBuild=18362"
       if "%ImageBuild%" geq "19041" if "%ImageBuild%" leq "19043" set "PackageBuild=19041"
    )
    
    :: Setting Package Service Pack Build
    if "%SelectedSourceOS%" equ "w10" (
       if "%ImageBuild%" geq "10586" if "%ImageBuild%" leq "15063" set "PackageServicePackBuild=0"
       if "%ImageBuild%" equ "16299" set "PackageServicePackBuild=15"
       if "%ImageBuild%" geq "17134" if "%ImageBuild%" leq "19043" set "PackageServicePackBuild=1"
    )
    
    After this step 01 select until the end of the session ":IntDedup" and perform steps 02 and 03.

    Nete: Make replacements only on selection.

    Step 02:
    from
    Code:
    ~%ImageVersion%
    
    to
    Code:
    ~10.0.%PackageBuild%
    
    Step 03:
    from
    Code:
    10.0.%ImageBuild%
    
    to
    Code:
    10.0.%PackageBuild%
    
    @MSMG had already implemented this in another part of the code at the request of someone else, I went through the code identifying more places where it is possible to implement this improvement. Credits to Master MSMG.
     
  5. RaiyvaN

    RaiyvaN MDL Senior Member

    Sep 23, 2009
    277
    317
    10
    Oops, I'm a little late on this answer, heheeheh

    Now that I saw that you had already answered right below his question.

    I have to read through to the end and then come back to offer some help if I can and is still needed.
     
  6. sergey130270

    sergey130270 MDL Member

    May 15, 2014
    133
    23
    10
    #19526 sergey130270, Jun 7, 2021
    Last edited: Jun 7, 2021
    Hi guys! Please help me write a command on how to disable a faulty WIM? We are talking about unsuccessful changes to the Windows image and then disconnecting it. Thank you.
    I have an example, but it doesn't always work:

    @echo off

    COLOR 1F
    TITLE Clean up script
    CLS

    set incorrectPath=0

    echo "%~dp0%" | findstr "(" >nul 2>&1
    if "%ERRORLEVEL%"=="0" set incorrectPath=1
    echo "%~dp0%" | findstr ")" >nul 2>&1
    if "%ERRORLEVEL%"=="0" set incorrectPath=1

    if not "%incorrectPath%"=="0" (
    ECHO.
    ECHO.
    ECHO ================================================================
    ECHO Please copy and run script from Desktop or another directory!
    ECHO ================================================================
    ECHO.
    PAUSE >NUL
    goto end
    )

    :: Setting Tools environment path variables
    If exist "%WinDir%\SysWOW64" (
    SET "Arch=x64"
    ) else (
    SET "Arch=x86"
    )

    set "PF=%ProgramFiles%"
    if not "%ProgramFiles(x86)%"=="" set "PF=%ProgramFiles(x86)%"

    ECHO.
    ECHO.
    ECHO ================================================================
    ECHO Unmounting mounted registry keys...
    ECHO ================================================================
    timeout /t 5 /NOBREAK >nul
    reg Unload HKLM\TK_COMPONENTS >nul 2>&1
    reg unload HKLM\TK_DEFAULT >nul 2>&1
    reg unload HKLM\TK_NTUSER >nul 2>&1
    reg unload HKLM\TK_SOFTWARE >nul 2>&1
    reg unload HKLM\TK_SYSTEM >nul 2>&1
    ECHO.
    ECHO Done!
    ECHO.

    ECHO.
    ECHO.
    ECHO ================================================================
    ECHO Unmounting mounted images...
    ECHO ================================================================
    ECHO.
    for /L %%i in (1, 1, 8) do (
    if exist "%~dp0mount\Windows\explorer.exe" (
    "%~dp0tools\%Arch%\DISM\dism.exe" /Unmount-Wim /MountDir:"%~dp0Mount\WinRE" /Discard
    "%~dp0tools\%Arch%\DISM\dism.exe" /Unmount-Wim /MountDir:"%~dp0mount" /Discard
    )
    )

    rd /s /q "%~dp0Mount\WinRE" >nul 2>&1
    rd /s /q "%~dp0mount" >nul 2>&1

    "%~dp0tools\%Arch%\DISM\dism.exe" /Cleanup-Mountpoints

    ECHO.
    ECHO.
    ECHO All done!
    ECHO.

    You can help?
     
  7. RaiyvaN

    RaiyvaN MDL Senior Member

    Sep 23, 2009
    277
    317
    10
    #19527 RaiyvaN, Jun 8, 2021
    Last edited: Jun 8, 2021
    Code:
    @echo off
    
    COLOR 1F
    TITLE Clean up script
    CLS
    
    echo "%~dp0%" | findstr "(" >nul 2>&1
    if "%ERRORLEVEL%"=="0" set incorrectPath=1
    echo "%~dp0%" | findstr ")" >nul 2>&1
    if "%ERRORLEVEL%"=="0" set incorrectPath=1
    
    if defined incorrectPath (
    ECHO.
    ECHO.
    ECHO ================================================================
    ECHO Please copy and run script from Desktop or another directory!
    ECHO ================================================================
    ECHO.
    PAUSE >NUL
    goto end
    )
    
    :: Setting Tools environment path variables
    If exist "%WinDir%\SysWOW64" (
    SET "Arch=x64"
    SET "PF=%ProgramFiles(x86)%"
    ) else (
    SET "Arch=x86"
    SET "PF=%ProgramFiles%"
    )
    
    ECHO.
    ECHO.
    ECHO ================================================================
    ECHO Unmounting mounted registry keys...
    ECHO ================================================================
    timeout /t 5 /NOBREAK >nul
    reg Unload HKLM\TK_COMPONENTS >nul 2>&1
    reg unload HKLM\TK_DEFAULT >nul 2>&1
    reg unload HKLM\TK_NTUSER >nul 2>&1
    reg unload HKLM\TK_SOFTWARE >nul 2>&1
    reg unload HKLM\TK_SYSTEM >nul 2>&1
    ECHO.
    ECHO Done!
    ECHO.
    
    ECHO.
    ECHO.
    ECHO ================================================================
    ECHO Unmounting mounted images...
    ECHO ================================================================
    ECHO.
    for /L %%i in (1, 1, 8) do (
    if exist "%~dp0mount\%%i\Windows\explorer.exe" (
    "%~dp0tools\%Arch%\DISM\dism.exe" /Unmount-Wim /MountDir:"%~dp0Mount\%%i\WinRE" /Discard
    "%~dp0tools\%Arch%\DISM\dism.exe" /Unmount-Wim /MountDir:"%~dp0mount\%%i" /Discard
    )
    )
    
    "%~dp0tools\%Arch%\DISM\dism.exe" /Cleanup-Mountpoints
    
    for /L %%i in (1, 1, 8) do (
    rd /s /q "%~dp0Mount\%%i\WinRE" >nul 2>&1
    rd /s /q "%~dp0mount\%%i" >nul 2>&1
    )
    
    ECHO.
    ECHO.
    ECHO All done!
    ECHO.
    
    I made some small changes in the part of the ProgramFiles and at the beginning, if the value 1 is set, the variable will be defined, so it will go to the end.
    I made the assumption that there is an index number for each mount point. So %%i were missing from the mount paths for "for" to run correctly.

    Note: maybe the registry unmount has to be inside the for loop for each index too.

    Code:
    @echo off
    
    COLOR 1F
    TITLE Clean up script
    CLS
    
    echo "%~dp0%" | findstr "(" >nul 2>&1
    if "%ERRORLEVEL%"=="0" set incorrectPath=1
    echo "%~dp0%" | findstr ")" >nul 2>&1
    if "%ERRORLEVEL%"=="0" set incorrectPath=1
    
    if defined incorrectPath (
    ECHO.
    ECHO.
    ECHO ================================================================
    ECHO Please copy and run script from Desktop or another directory!
    ECHO ================================================================
    ECHO.
    PAUSE >NUL
    goto end
    )
    
    :: Setting Tools environment path variables
    If exist "%WinDir%\SysWOW64" (
    SET "Arch=x64"
    SET "PF=%ProgramFiles(x86)%"
    ) else (
    SET "Arch=x86"
    SET "PF=%ProgramFiles%"
    )
    
    ECHO.
    ECHO.
    ECHO ================================================================
    ECHO Unmounting mounted images...
    ECHO ================================================================
    ECHO.
    for /L %%i in (1, 1, 8) do (
    if exist "%~dp0mount\%%i\Windows\explorer.exe" (
    call :UnmountRegistry
    "%~dp0tools\%Arch%\DISM\dism.exe" /Unmount-Wim /MountDir:"%~dp0Mount\%%i\WinRE" /Discard
    "%~dp0tools\%Arch%\DISM\dism.exe" /Unmount-Wim /MountDir:"%~dp0mount\%%i" /Discard
    )
    )
    
    "%~dp0tools\%Arch%\DISM\dism.exe" /Cleanup-Mountpoints
    
    for /L %%i in (1, 1, 8) do (
    rd /s /q "%~dp0Mount\%%i\WinRE" >nul 2>&1
    rd /s /q "%~dp0mount\%%i" >nul 2>&1
    )
    
    ECHO.
    ECHO.
    ECHO All done!
    ECHO.
    
    :UnmountRegistry
    ECHO.
    ECHO.
    ECHO ================================================================
    ECHO Unmounting mounted registry keys...
    ECHO ================================================================
    timeout /t 5 /NOBREAK >nul
    reg Unload HKLM\TK_COMPONENTS >nul 2>&1
    reg unload HKLM\TK_DEFAULT >nul 2>&1
    reg unload HKLM\TK_NTUSER >nul 2>&1
    reg unload HKLM\TK_SOFTWARE >nul 2>&1
    reg unload HKLM\TK_SYSTEM >nul 2>&1
    ECHO.
    ECHO Done!
    ECHO.
    goto :EOF
    
     
  8. Caleb28

    Caleb28 MDL Novice

    Dec 7, 2019
    3
    1
    0
    #19528 Caleb28, Jun 8, 2021
    Last edited: Jun 8, 2021
    Hi. I just purchased Windows 10 Pro and may move to it from Win 8.1 Pro and have been trying to research MSMG Toolkit as much as possible but am still confused and have questions:

    1) I don't mean to offend anyone - especially the MSMG Toolkit's creator - and I understand the creator is quite trusted but is it possible for the MSMG Toolkit to contain / add / inject any type of malware, keyloggers, spyware, trojans, etc.? Is MSMG open-source and have people checked the coding to make sure it doesn't do anything to the PC, to the custom-created / edited Windows 10 ISO it creates, etc. which can compromise security and/or privacy? I don't want to risk downloading someone else's custom created ISO (regardless how trusted the ISO's creator may be) but that then got me thinking, is using the MSMG Toolkit myself to create my own ISO really any different???...

    2) I tried MSMG Toolkit and the default Windows ISO is around 4 GB but the custom one that MSMG created was around 8 GB. If all I did was remove things from the default Windows ISO, shouldn't the custom one be even smaller than the default and not larger (let alone around 2x as large)?

    3) Can I use the default Win 10 ISO for the install, fully install all drivers (chipset, IMEI, audio, ethernet, graphics, etc.), fully update Win 10, and then get rid of all the Win 10 bloat which can affect things like security, privacy, CPU usage, RAM usage, etc. via registry-edits, script-running, removing apps, disabling services, and using programs (eg. O&O ShutUp10, WPD, Blackbird, etc.)? Or does MSMG Toolkit remove / disable / block things that cannot be otherwise removed / disabled / blocked on an already installed Win 10 setup using those other listed methods?
     
  9. Supern00b

    Supern00b MDL Addicted

    Dec 30, 2010
    649
    420
    30
    I'll give it a shot, surely others can give a more complete and/or correct answer.
    1) The cmd script is plain text, the toolkit helper itself is not open source (which is completely understandable). But If MSMG would want to distribute any kind of malware, easier methods would be available to do just that.
    I have been building images with MSMG toolkit for quite some time and have never found any suspicious files or activity.

    2) Maybe you forgot to cleanup and rebuild the image. That step is really necessary. It's in one of the menu's. Please refer to the readme file.

    3) MSMG is not a privacy tool in itself. You can remove or ad some packages, but there is no special focus on privacy. To achieve that, you can indeed run some tools like O&O shutup10 or the likes after deployment.
    Some users have posted customized scripts to do that.
    So, the first part of your third question is affirmative.

    Cheers.
     
  10. sergey130270

    sergey130270 MDL Member

    May 15, 2014
    133
    23
    10
    ================================================================
    Unmounting mounted registry keys...
    ================================================================

    Done!
    Режим вывода команд на экран (ECHO) отключен.


    ================================================================
    Unmounting mounted images...
    ================================================================

    Deployment Image Servicing and Management tool
    Version: 10.0.20339.2

    Image File : C:\Win\Integrator10\DVD\sources\boot.wim
    Image Index : 1
    Unmounting image
    [==========================100.0%==========================]

    Error: 0xc1420117

    The directory could not be completely unmounted. This is usually due to applications that still have files opened within the mount directory. Close these files and unmount again to complete the unmount process.

    The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

    Deployment Image Servicing and Management tool
    Version: 10.0.20339.2

    Image File : C:\Win\Integrator10\DVD\sources\boot.wim
    Image Index : 1
    Unmounting image
    [==========================100.0%==========================]

    Error: 0xc1420117

    The directory could not be completely unmounted. This is usually due to applications that still have files opened within the mount directory. Close these files and unmount again to complete the unmount process.

    The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

    Deployment Image Servicing and Management tool
    Version: 10.0.20339.2

    Cleaning up image
    Unmounting image at C:\Win\Integrator10\Mount
    [==========================100.0%==========================]
    Scanning drive C for stale files
    Scanning drive D for stale files
    Scanning drive E for stale files
    Scanning drive F for stale files
    Scanning drive G for stale files
    The operation completed successfully.
     
  11. ezgera

    ezgera MDL Novice

    Dec 25, 2019
    20
    1
    0
    hello people,
    does any / latest versions include V1709 removal tool and options yet ?
     
  12. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    5,392
    11,290
    180
    Yes I have uploaded them but without the new Toolkit.cmd you can't use it to integrate the games since the image indexes do change in the pack.

     
  13. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    5,392
    11,290
    180
    For Extracting drivers from system the standard DISM command

    Code:
    DISM /Online /Export-Driver /Destination:<Drivers-Folder>
    
    For importing drivers into the image the standard DISM command

    Code:
    DISM /Image /Add-Driver /Driver:<Drivers-Folder> /Recurse
    
    For built-in drivers you may need to manually search and copy the related files and then import them.

     
  14. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    5,392
    11,290
    180
    Instead of adding the code in every features integration functions, I moved the code to Select source from DVD function so that while mounting the image the PackageVersion, PackageBuild, PackageServicePackBuild, PackageArchitecture is defined only once.


     
  15. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    5,392
    11,290
    180
    If the script was terminated while integrating any packages, the DISM mounted image registry hives need to be unmounted before trying to unmount the image.

    DISM mounted image registry hives are different from HKLM\TK_COMPONENTS, HKLM\TK_SOFTWARE, HKLM\TK_SYSTEM.

    Usually the DISM uses the full file path of the registry hive as the registry hive name, you can check the HKLM registry hive for the list of mounted.

     
  16. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    5,392
    11,290
    180
    Thanks for trying The Toolkit.

    1) The main Toolkit script is open sourced, but it's sub-tools like component remover is closed source. The Toolkit files and it's add-on feature packs are free from malware, keyloggers, spyware or any virus.

    Due to the code protection added to the component remover program many Antivirus programs may flag the Toolkit's component remover program as virus or trojan, don't worry this is just false positive sign.

    You can install and monitor the Toolkit created image on Virtual PC like Hyper-V/VMware/VirtualBox for any suspicious activity and then decide whether to deploy the image to your main PC.

    2) Make sure you are using the latest version of Toolkit and also delete other indexes present in the image to get real image size.

    3) The Toolkit only supports offline images and yes you can integrate the drivers and updates to the image before removing the components.

    For component removal you may need to integrate the cumulative update specified in the changelog.

    Note: Starting from Windows 10 v1903 onwards, the Microsoft implemented new update package format due to which the removed components will return when the system is updated either through Windows update or manual update install using .msu or .cab file. Only the Windows Apps component is not affected by this issue.


     
  17. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    5,392
    11,290
    180
    No.

     
  18. RaiyvaN

    RaiyvaN MDL Senior Member

    Sep 23, 2009
    277
    317
    10
    Yes, I thought so too. It was one of the Custom 11.4 mods. But to help on this occasion it had to be added in the specific section. We are in sync :rolleyes::D
     
  19. sergey130270

    sergey130270 MDL Member

    May 15, 2014
    133
    23
    10
    #19540 sergey130270, Jun 8, 2021
    Last edited: Jun 8, 2021
    THANK YOU
    Hello dear! I have the HKLM registry hives for a list of connected ones like this:
    %~dp0tools\Mount\Windows\System32\config\COMPONENTS
    %~dp0tools\Mount\Windows\System32\config\DEFAULT
    %~dp0tools\Mount\Windows\System32\config\DRIVERS
    %~dp0tools\Mount\Windows\System32\config\SAM
    %~dp0tools\Mount\Windows\System32\config\SECURITY
    %~dp0tools\Mount\Windows\System32\config\SOFTWARE
    %~dp0tools\Mount\Windows\System32\config\SYSTEM
    %~dp0tools\Mount\Users\Default\NTUSER

    Help me please.
    I am very ashamed for begging, but this is the only site where I can really get a lot of help from you. Excuse me, please.