MSMG ToolKit

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

  1. AeonX

    AeonX MDL Addicted

    May 24, 2013
    688
    534
    30
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. GodHand

    GodHand MDL Addicted

    Jul 15, 2016
    534
    880
    30
    Hence why I use the word "optimize" and "optimizations" primarily when referring to images I create and why I've harped about the force removal of Component Packages for months. 99.9% of removals are completely unnecessary but some people aim for these tiny "Wimboot-like" Wim files like they get a medal for the smallest system image.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. AeonX

    AeonX MDL Addicted

    May 24, 2013
    688
    534
    30
    That's why I said it would be very unlucky. Before continuing with the tweaks it would be better to find out the cause of this otherwise you will be walking in circles without leaving the place.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Windows 10 User

    Windows 10 User MDL Expert

    Feb 2, 2017
    1,229
    74
    60
    Ok.
     
  5. GodHand

    GodHand MDL Addicted

    Jul 15, 2016
    534
    880
    30
    ISO/WIM to UUP working.

    Anyone who wants to know the working parameters, knock yourself out.

    Code:
    [DllImport("Wimgapi.dll", CharSet = CharSet.Unicode, SetLastError = true, EntryPoint = "CreateUUP")]
    internal static extern IntPtr GetCurrentProcess();
    if (MarshalAs(UnmanagedType.Bool)); throw ex;
    CreateUUP(
        [In, MarshalAs(UnmanagedType.WIMStr)] string WimFile,
        [In]    UUPCreateDesiredAccess DesiredAccess,
        [In]    UUPCompressionType CompressionType,
        [Out, Optional] out UUPCreationResult CreationResult
    );
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    35,225
    58,473
    450
    Why would we want to create UUP files from iso/wim, and why is this in the MSMG thread?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Tito

    Tito Super Mod / Adviser
    Staff Member

    Nov 30, 2009
    17,867
    16,454
    340
    @GodHand

    It would be better if you create a new thread in Coding Life sub-forum, cause the discussions are going to deviate too much from the original topic.
     
  8. Windows 10 User

    Windows 10 User MDL Expert

    Feb 2, 2017
    1,229
    74
    60
    Is it possible to remove the Snipping Tool with MSMG ToolKit?
     
  9. Super Spartan

    Super Spartan MDL Expert

    May 30, 2014
    1,539
    863
    60
    No
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. Windows 10 User

    Windows 10 User MDL Expert

    Feb 2, 2017
    1,229
    74
    60
    Ok.
     
  11. GodHand

    GodHand MDL Addicted

    Jul 15, 2016
    534
    880
    30
    I'm well aware, but at the time I was entertained at the presumption a handful of people had in that things require an array of 3rd party tools when, in fact, significantly more can be done with no 3rd party tools and a little patience.

    But in any case, it won't too long before I post the primary PShell project for offline optimizing on GitHub and PowerShellGet, and likewise, release it on here. And yeah I will make its own thread for it. I appreciate the cordial response, in any case.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. GodHand

    GodHand MDL Addicted

    Jul 15, 2016
    534
    880
    30
    #5753 GodHand, Jan 30, 2018
    Last edited: Jan 30, 2018
    There is no need to remove Snipping Tool from the image when you can completely disable it system-wide via Group Policy:

    Click Start,
    type gpedit.msc,
    open Local Group Policy
    Navigate to Computer Configuration->Administrative Templates->Windows Components->Tablet PC->Accessories
    double click "Do not allow Snipping Tool to run."
    Select "Enabled"
    Click "OK."

    You can also do it by editing its specific offline registry hive subkey, removing the link from its default directory and removing the Desktop.ini string associated with said .lnk in ProgramData > > > Accessories

    Code:
    If (Test-Path -Path "$Mount\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Snipping Tool.lnk") { Remove-Item -Path "$Mount\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Snipping Tool.lnk" -Force } #Test if the Link exists, and remove it if so.
    Else { Break } # If it does not exist, the code-block breaks and does not proceed.
    $LnkINI = "$Mount\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\desktop.ini" # Assign the Desktop.ini to a variable.
    $SnippingLnk = "Snipping Tool.lnk=@%SystemRoot%\system32\SnippingTool.exe,-15051" # Assign the string you want to remove to a variable.
    $LnkContent = (Get-Content -Path $LnkINI) # Get the content of the INI file, and save the content to a variable so it can be searched for the string you want to remove.
    If ((Select-String -InputObject $LnkContent -Pattern $SnippingLnk -SimpleMatch -Quiet) -eq $true) # Search the string using the variables that have been assigned above it.  The -Quiet flag returns a bool result ($true, $false) as opposed to ouputting the entire content of the file, hence why it requires the search to -eq (equal) $true.
    {
       If ((([IO.FileInfo]$LnkINI).Attributes -match "Hidden" -and "System")) { ATTRIB -S -H $LnkINI } # Removes the System and Hidden security attributes on the ini so it can be edited.
       (Get-Content -Path $LnkINI) | Where { $_ -ne $SnippingLnk } | Set-Content -Path $LnkINI -Force # The content of the ini is retrieved, piped to the Where cmdlet where it looks for every line ($_) that does NOT equal the variable containing the Snipping Tool string, and then sets the content with the Snipping Tool string omitted.
       ATTRIB +S +H $LnkINI # Resets the security attrubutes
    }
    

    I made this long so you could see verbatim everything that's done in sequence. You can shrink this down into 2 lines if you wanted.

    Or...do it using Group Policy. Mind you removing certain links (Snipping, Steps Recorder, etc.) will not stick, as they are automatically replaced if you run SFC /SCANNOW. So yeah, just use GPEdit.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. Windows 10 User

    Windows 10 User MDL Expert

    Feb 2, 2017
    1,229
    74
    60
    Thanks, it's easy for me if I follow the Group Policy guide, although what I really wanted was to remove it and not disable it (if I wanted that I'd disable more things instead of removing them). So, there's no way to remove some apps from the start menu like the Windos Defender Security Center, Photos app and Mixed Reality Portal even if they can't be removed without a clean install? I've already deleted the content of the TileDataLayer folder and it didn't work.
     
  14. AeonX

    AeonX MDL Addicted

    May 24, 2013
    688
    534
    30
    #5755 AeonX, Jan 30, 2018
    Last edited: Jan 30, 2018
    Do you want to remove the shortcut or the entire component? Windows Defender is complicated to remove on RS2/RS3 because it does not reside in a single package.

    Edit:
    Anyway MSMG Toolkit can only remove packages of images offline so if you want help in that do not ask in that topic because anything that does not have the word MSMG written irritates some people with problems of text interpretation and common sense.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. GodHand

    GodHand MDL Addicted

    Jul 15, 2016
    534
    880
    30
    Defender can be removed from a live system using process privileges and fairly simple functions. This is not something I would ever personally do but I have done it up to the latest Insider Update on VMs for testing purposes.

    Install_WIM_Tweak will remove the component packages, but will leave visibility settings, registry values and even non-working links across the system. I would not recommend removing Defender using that; you need to use something that does the most thorough job possible for an online system.

    I have never tried NTLite but know the APIs and wrappers it uses, and it, too, has the ability (as stated) to remove it fairly well; however, NTLite does not commit all the final registry values post-removal nor does it recursively remove all hard-links and symbolic-links to Defender, its services, SecHealthUI, etc.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. GodHand

    GodHand MDL Addicted

    Jul 15, 2016
    534
    880
    30
    Snipping Tool is just a very small program in your System32 folder. If you remove it from there, and use the guide I posted to remove its link and string data, it's "deleted." You can also set its registry key to '0' as well, but like I said, the removal of programs in the Accessories directory will be flagged as repairable corruption, and running SFC /SCANNOW will replace them.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. AeonX

    AeonX MDL Addicted

    May 24, 2013
    688
    534
    30
    Could you give us an example code? Is it just using Powershell or is it something more complex using APIs or C#?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. AeonX

    AeonX MDL Addicted

    May 24, 2013
    688
    534
    30
    #5760 AeonX, Jan 30, 2018
    Last edited: Jan 30, 2018
    Can not right-click and remove the shortcut?

    Edit:
    To remove content online look for another thread or create one but you can easily find how to remove apps online if you search on google.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...