Optimize-Offline Guide - Windows Debloating Tool, Windows 1803, 1903, 19H2, 1909, 20H1 and LTSC 2019

Discussion in 'Windows 10' started by KedarWolf, Jul 30, 2019.

  1. bay12

    bay12 MDL Junior Member

    Nov 30, 2014
    84
    13
    0
    Thanks, i was referring to this script which works fine. I'm just wondering if it's possible also to delete the files from the systemapps folder without sfc tringgering an integrity error.
     
  2. MonarchX

    MonarchX MDL Expert

    May 5, 2007
    1,732
    313
    60
    You have my approval!
     
  3. SuperVas220

    SuperVas220 MDL Novice

    May 4, 2018
    8
    2
    0
    I made new tests and can confirm that the problem is repeatable.

    I used VM under Virtualbox 6.0.14 and original ISO of Windows 10 1909 from Microsoft. I created a new VM with this ISO and everything is OK. It boots in BIOS mode.
    In this VM I used Optimize-Offline tool 3.2.7.8 and made a new ISO with only 1 WinApp removed. This second ISO DO NOT BOOT in Virtualbox in BIOS mode, but in UEFI it boots.
    Also, when I extract the new ISO with 7-ZIP, it displays a warning that there is data after the payload. This message DOES NOT emerge with the original Microsoft ISO.

    The log files are clean, with 0 errors. I think there are some circumstances in the ISO creation, that are not dealth with by the best way. Maybe something with the Windows API?
     
  4. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
  5. garf02

    garf02 MDL Member

    Sep 15, 2007
    181
    68
    10
    Not exists any options for exclude the dart integration
     
  6. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
    Edit the bottom of Start-Optimize.ps1 with your required paramaters
    Mine (Used with 19033):
    Code:
    Else
    {
       Optimize-Offline -SourcePath "D:\19033.1000\sources\install.wim" -WindowsApps "Whitelist" -SystemApps -Capabilities -Packages -Features -Registry -Additional
    }
    
    The above, Outputs (in my case) this Configuration.json Template at the end of the optimization, for future use
    {
    "_Info": [
    "This is a JSON based Configuration file for Optimize-Offline.",
    "Ensure proper formatting is used when editing the JSON parameter values.",
    "Boolean parameter values use true and false. String parameter values must be enclosed in double-quotes."
    ],
    "SourcePath": "D:\\19033.1000\\sources\\install.wim",
    "WindowsApps": "Whitelist",
    "SystemApps": true,
    "Capabilities": true,
    "Packages": true,
    "Features": true,
    "DeveloperMode": ,
    "WindowsStore": ,
    "MicrosoftEdge": ,
    "Win32Calc": ,
    "Dedup": ,
    "Registry": true,
    "Additional": true
    }

    Hope this helps...
     
  7. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
  8. garf02

    garf02 MDL Member

    Sep 15, 2007
    181
    68
    10
    Many many thanks!
     
  9. zbigniew59

    zbigniew59 MDL Senior Member

    May 14, 2016
    374
    171
    10
    What does it mean ? - Optimize-Offline now requires a system culture of en-US. - doesn't work if iso is pl-pl ?
    I do not understand English well.
     
  10. KedarWolf

    KedarWolf MDL Addicted

    Mar 17, 2016
    977
    870
    30
  11. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
    Jumped the gun
    .. looking in to this further, it seems there may be some issues

    JSON Template (Output by Optmize Offline Script)
    Code:
    {
      "_Info": [
        "This is a JSON based Configuration file for Optimize-Offline.",
        "Ensure proper formatting is used when editing the JSON parameter values.",
        "Boolean parameter values use true and false. String parameter values must be enclosed in double-quotes."
      ],
      "SourcePath": "D:\\19035.1000\\sources\\install.wim",
      "WindowsApps": "Whitelist",
      "SystemApps": true,
      "Capabilities": true,
      "Packages": true,
      "Features": true,
      "DeveloperMode": ,
      "WindowsStore": ,
      "MicrosoftEdge": ,
      "Win32Calc": ,
      "Dedup": ,
      "Registry": true,
      "Additional": true
    }
    
    (1) Parameters set are more than 2
    line 56 # If the ordered collection list has a key count less than two, terminate the script. Else call Optimize-Offline passing all of our set parameters to it.
    line 57 If ($ConfigParams.Count -lt 2) <-- If 2 is used script terminates with following error

    PS D:\Optimize-Offline-4.0.0.0> .\Start-Optimize.ps1
    ConvertFrom-Json : Invalid JSON primitive: .
    At D:\Optimize-Offline-4.0.0.0\Start-Optimize.ps1:40 char:32
    + $ContentJSON = $ContentJSON | ConvertFrom-Json
    + .....................................................~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: ( : ) [ConvertFrom-Json], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand


    WARNING: There are not enough parameters set to optimize an image.
    PS D:\Optimize-Offline-4.0.0.0>

    (2)
    line 57 If ($ConfigParams.Count -lt 2) <-- If 2 is changed to 0 it will run the script with the following parameters (Completing without any errors)

    line 63 Else
    line 64 {
    line 65 Optimize-Offline -SourcePath "D:\19035.1000\sources\install.wim" -WindowsApps "Whitelist" -SystemApps -Capabilities -Packages -Features -Registry -Additional

    .. and the subsequent .json template (reproduced above) confims the parameters are as stated.

    However on closer inspestion it is clearly apparent that the -Additional switch (Setup, Additional Registry Tweaks) is not implemented nor applied to the image

    ... am I missing something
     
  12. KedarWolf

    KedarWolf MDL Addicted

    Mar 17, 2016
    977
    870
    30
    You forgot the , after true?
     
  13. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
    .. not the case (don't actually code myself), JSON used was one created by the script itself
    also, "Additional" being the last parameter of the set, should not require a comma after it
    but just to be sure, ran script with comma - no difference, same issue -> fails at line 40 with Invalid JSON primitive

    but as previously stated, I bypass the issue by changing line 57 $ConfigParams.Count -lt from 2 to 0.
    Script runs but does not apply the "Additional" parameter

    From 4.0.0.0 19035.Log
    Code:
    2019-12-05T22:23:24 [INFO]: Applying Optimized Registry Settings.
    2019-12-05T22:23:32 [INFO]: Cleaning-up the Start Menu Layout.
    2019-12-05T22:23:35 [INFO]: Creating a Package Summary Log.
    
    From 3.2.7.8 19035.Log
    Code:
    2019-12-05T23:56:34 [INFO]: Applying Optimizations to the Offline Registry Hives.
    2019-12-05T23:56:43 [INFO]: Applying Setup Content. <<<---
    2019-12-05T23:56:46 [INFO]: Importing Registry Templates. <<<---
    2019-12-05T23:56:48 [INFO]: Cleaning-up the Start Menu Layout.
    2019-12-05T23:56:51 [INFO]: Creating a Package Summary Log.
    
     
  14. KedarWolf

    KedarWolf MDL Addicted

    Mar 17, 2016
    977
    870
    30
    My 4.0.0.0 log.
    Code:
    2019-12-03T00:43:51 [INFO]: Applying Optimized Registry Settings.
    2019-12-03T00:43:55 [INFO]: Applying Setup Content.
    2019-12-03T00:43:58 [INFO]: Applying Wallpaper.
    2019-12-03T00:44:01 [INFO]: Applying System Logo.
    2019-12-03T00:44:04 [INFO]: Applying Lock Screen.
    2019-12-03T00:44:07 [INFO]: Importing Registry Templates.
    2019-12-03T00:44:10 [INFO]: Applying Answer File.
    2019-12-03T00:44:16 [INFO]: Injecting Driver Packages into Windows 10 Enterprise
    2019-12-03T00:44:20 [INFO]: Injecting Driver Packages into Microsoft Windows Setup (x64)
    2019-12-03T00:44:23 [INFO]: Injecting Driver Packages into Microsoft Windows Recovery Environment (x64)
    2019-12-03T00:44:26 [INFO]: Cleaning-up the Start Menu Layout.
    2019-12-03T00:44:29 [INFO]: Creating a Package Summary Log.
    2019-12-03T00:44:35 [INFO]: Post-Optimization Image Health State: [Healthy]
    
    My D:\Optimize-Offline-4.0.0.0\Optimize-Offline-4.0.0.0\Configuration.json

    Code:
    {
      "_Info": [
        "This is a JSON based Configuration file for Optimize-Offline.",
        "Ensure proper formatting is used when editing the JSON parameter values.",
        "Boolean parameter values use true and false. String parameter values must be enclosed in double-quotes."
      ],
      "SourcePath": "D:\\1\\Win10_18363.476_x64_2019-11-24.iso",
      "WindowsApps": "Select",
      "SystemApps": true,
      "Capabilities": true,
      "Packages": true,
      "Features": true,
      "DeveloperMode": true,
      "WindowsStore": false,
      "MicrosoftEdge": false,
      "Win32Calc": true,
      "Dedup": false,
      "Registry": true,
      "Additional": true,
      "ISO": "No-Prompt"
    }
    
    My D:\Optimize-Offline-4.0.0.0\Optimize-Offline-4.0.0.0\Content\Additional\Additional.json

    Code:
    {
      "Setup": true,
      "Wallpaper": true,
      "SystemLogo": true,
      "LockScreen": true,
      "RegistryTemplates": true,
      "Unattend": true,
      "Drivers": true,
      "NetFx3": false
    }
    
     
  15. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
    @Kedar Wolf
    apart from our different requirements (ie. have no use for ISO, so it is omitted), there are no differences
    - same script, and valid json files (Configuration/Additional). However, on running (in my case) the Start-Optimize.ps1 script fails

    ConvertFrom-Json : Invalid JSON primitive: . suggesting that a DOT (.) there is the issue
    At D:\Optimize-Offline-4.0.0.0\Start-Optimize.ps1:40 char:32 (Line 40 Character 32, which is nothing but a space)

    but as I said I don't code and can't fathom at the moment what the problem is

    Script has been run with JSON formatted both ways
    using "WindowsStore": false, or "WindowsStore": ,
    .... but to no avail. Will continue to investigate further ... entertaining

    Edit: with a bit of luck Godhand may be monitoring and may be able to shed some light
     
  16. SuperVas220

    SuperVas220 MDL Novice

    May 4, 2018
    8
    2
    0
    I can confirm, that there is an issue somewhere in the parameters section, because when I ran the script with only "windowsApp" and/or "SystemApp" parameters, besides "ISO" and "SourcePath", not every time the windows for selecting apps for removal appear. The "WindowsApp" is set to "Select", but it does not show every time.

    Which parameters are counted in the above mentioned number 2?

    I also hope that the GUI version will be more stable.
     
  17. asache

    asache MDL Junior Member

    Apr 11, 2008
    97
    24
    0
    i love this s**t when you do all the steps believing will work like is working to the others and in the end dosent work.
     
  18. KiDFuZioN

    KiDFuZioN MDL Novice

    Jan 21, 2010
    11
    1
    0
    You need to add false to each item that you don't want in your Configuration.json. They shouldn't be left blank.

    Code:
    {
      "_Info": [
        "This is a JSON based Configuration file for Optimize-Offline.",
        "Ensure proper formatting is used when editing the JSON parameter values.",
        "Boolean parameter values use true and false. String parameter values must be enclosed in double-quotes."
      ],
      "SourcePath": "D:\\19035.1000\\sources\\install.wim",
      "WindowsApps": "Whitelist",
      "SystemApps": true,
      "Capabilities": true,
      "Packages": true,
      "Features": true,
      "DeveloperMode": false,
      "WindowsStore": false,
      "MicrosoftEdge": false,
      "Win32Calc": false,
      "Dedup": false,
      "Registry": true,
      "Additional": true
    }