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. zbigniew59

    zbigniew59 MDL Senior Member

    May 14, 2016
    374
    171
    10
    Sorry to ask - what are the signs -ge, -lt, -eq, -lt?
     
  2. strotee

    strotee MDL Member

    Jan 30, 2011
    229
    204
    10
    you must not be a golfer, -ge (greater than or equals), -lt (less than), -eq (equals)
    if you don't know what you're doing then I don't advise monkeying with these files or it'll break O-O on your machine.
     
  3. Assasin13

    Assasin13 MDL Novice

    Aug 14, 2016
    23
    2
    0
  4. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
    #664 drew84, Nov 15, 2020
    Last edited: Nov 15, 2020
    ... script is 5 years old (last edited 3 years ago), not sure I would entertain using it

    ... believe you need to use .ISO as source (not .wim) .. edit .json setup = true, edit Content/Additional/Setup/ SetpComplete.cmd to call Remove-OneDrive.cmd -> see ReadMe.md in Setup folder
    further info credit @spanishfly
     
  5. Ren Hattori

    Ren Hattori MDL Novice

    Nov 15, 2020
    2
    0
    0
    #665 Ren Hattori, Nov 15, 2020
    Last edited: Nov 15, 2020
    @spnanishfly raised an issue on the github Optimize-Offline issues page regarding the need to update a key in the file \Content\Additional\Setup\Set-Additional.ps1. As it seems, the
    "HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AutoLogger-Diagtrack-Listener"
    was renamed to
    "HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener"
    In the newer O-O 4.0.1.7 the issue remains… However, it applies “4” (disabled) to the “Start” value of “AutoLogger-Diagtrack-Listener” and others (check line 90), and not the suggested “0” (boot start).
    In addition, I believe the “Status” should also be set to “0” (needs confirmation), as the Status seems to be related to the system general telemetry settings (also needs confirmation). I can’t find much about this anyway… specially from M$...
    Can anybody please confirm or correct me if I'm wrong :confused:
     
  6. KedarWolf

    KedarWolf MDL Addicted

    Mar 17, 2016
    977
    870
    30
    About the 'Set-Additional.cmd'.

    Before you run it, paid Microsoft Store apps like games install just fine.

    After running it I get a weird Windows Update is disabled error. Windows Update IS working and I checked, all the Windows Update and other required services for the Microsoft Store ARE running.

    Any ideas anyone?
     
  7. Ren Hattori

    Ren Hattori MDL Novice

    Nov 15, 2020
    2
    0
    0
    "Set-Additional.cmd" only checks for elevation in order to set the execution policy to “bypass”, and triggers the "Set-Additional.ps1". I can’t check right now on a live system… try changing the status of the services disabled by the shell script (line 52). My guess would be "UnistoreSvc" and "UserDataSvc" (by default they are set as manual). Other than that, at first glance, maybe the firewall rules? The “Delivery Optimization” (line 98)?
     
  8. lo lol

    lo lol MDL Novice

    Aug 31, 2019
    4
    0
    0
    #668 lo lol, Nov 16, 2020
    Last edited: Nov 16, 2020
    Hello, any answer to this? Setup is set True in json file or am I misunderstading something?
     
  9. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
    I am pretty sure this has been covererd in the thread previously
    .. merely points to the Content/Additional/Setup Folder of 4.0.1.7, allowing the stuff in there to run see readme in folder

    1. use Rufus to create bootable media of original .ISO
    2. Point O-O to install.wim in sources folder of USB
    3. Optimize your image
    4. replace install.wim in USB/Sources with newly optimized install.wim in O-O Folder (dated).. and you are good to go

    if you really need an ISO there are many cd/dvd tools available that can convert the contents of the USB folder to a bootable ISO... just google

    hope this helps
     
  10. DarthVader1

    DarthVader1 MDL Novice

    Jul 9, 2017
    3
    1
    0
    Code:
    Index     : 0
    Exception : The process cannot access the file because it is being used by another process.
               
    Category  : NotSpecified: (:) [Get-AppxProvisionedPackage], COMException
    ErrorID   : Microsoft.Dism.Commands.GetAppxProvisionedPackageCommand
    Target    : 
    Command   : If ((Get-AppxProvisionedPackage -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 
                1).Count -eq 0) { Get-ChildItem -Path (GetPath -Path $InstallMount -Child 'Program Files\WindowsApps') -Force | Purge 
                -Force }
    Script    : C:\Users\win\Optimize-Offline-4.0.1.7\Optimize-Offline.psm1
    Line      : 615
    Column    : 11
    
    Any idea why i get this error?
     
  11. KedarWolf

    KedarWolf MDL Addicted

    Mar 17, 2016
    977
    870
    30
    #671 KedarWolf, Nov 17, 2020
    Last edited: Nov 17, 2020
    (OP)
    Sometimes if you have a folder open and File Explorer open you get that error. Try closing all File Explorer windows when running the script.

    I know of one person that had to end task the explorer.exe process in the Task Manager and restart it when they were done.

    I believe if you open Task Manager and browse to the C:\Windows folder you can start explorer.exe from there after end tasking it when the script is done.
     
  12. DarthVader1

    DarthVader1 MDL Novice

    Jul 9, 2017
    3
    1
    0
    Ok thank you. I'll test this and I return to you for feedback.
     
  13. DarthVader1

    DarthVader1 MDL Novice

    Jul 9, 2017
    3
    1
    0
    I just did the kill explorer.exe method seems not to work.
    That doesn't seem to be the problem.
    I see by quickly browsing the script that the instruction is correctly executed in previous line but it can't access for this specific call.
     
  14. Assasin13

    Assasin13 MDL Novice

    Aug 14, 2016
    23
    2
    0
    Question: How can i execute Scheduledtasks.json and Services.json in Additional Setup?
    Also are there any addtional regitry tweaks / scripts that someone can suggest?
     
  15. zb9525

    zb9525 MDL Novice

    Apr 24, 2017
    37
    19
    0
    call “%WinDir%\ Setup \ Scripts \ Set-Additional.cmd”
     
  16. Assasin13

    Assasin13 MDL Novice

    Aug 14, 2016
    23
    2
    0
    So a setupComplete.cmd like this should do the work right?

    Code:
    CD /D "%~dp0"
    
    REM Answer files should ALWAYS be removed from the 'Windows\Panther' and 'Windows\System32\Sysprep' directories immediately after they've been processed.
    
    PowerShell.exe -NoProfile -ExecutionPolicy Bypass -File "%WINDIR%\Setup\Scripts\Refresh-Explorer.ps1"
    PowerShell.exe -NoProfile -ExecutionPolicy Bypass -File "%WINDIR%\Setup\Scripts\Remove-OneDrive.ps1"
    PowerShell.exe -NoProfile -ExecutionPolicy Bypass -File "%WINDIR%\Setup\Scripts\Set-Additional.ps1"
    DEL /F /Q "%WINDIR%\Setup\Scripts\Remove-OneDrive.ps1" >NUL 2>&1
    DEL /F /Q "%WINDIR%\Setup\Scripts\Refresh-Explorer.ps1" >NUL 2>&1
    DEL /F /Q "%WINDIR%\Setup\Scripts\Set-Additional.ps1" >NUL 2>&1
    DEL /F /Q "%WINDIR%\Panther\unattend.xml" >NUL 2>&1
    DEL /F /Q "%WINDIR%\System32\Sysprep\unattend.xml" >NUL 2>&1
    DEL "%~f0"
     
  17. Loxmox

    Loxmox MDL Novice

    Oct 23, 2020
    17
    7
    0
    I did everything as you described and got these warnings.
    Can't pass through it, any ideas?

     
  18. KedarWolf

    KedarWolf MDL Addicted

    Mar 17, 2016
    977
    870
    30
    In the D:\Optimize-Offline-4.0.1.7\Optimize-Offline-4.0.1.7\Src\ folder in Offline-Resources.psm1 file change en-US to en-GB with Notepad++ and save.
     
  19. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
    #680 drew84, Dec 1, 2020
    Last edited: Dec 1, 2020
    I assume you are referring to Post #660

    The issue you are describing was exactly the problem I was experiencing with versions prior to 4.1.7, where for some reason it worked
    Before version 4.1.7 the only resolution that worked for me was to;

    Optimize-Offline-4.0.1.7\Src\Public\en-US <- leave as en-US
    Optimize-Offline-4.0.1.7\Src\Offline-Resources.psm1 <- Leave culture as en-US

    ... but bear in mind @KedarWolf's Post #655 (a direct response to my using the above workaround)
    that some things like calculator may not get integrated, don't use it so never noticed the issue

    .. Edit: Just completed a test on 20262 (without above workaround) with no issues
    Code:
    ***************************************************************************************************
    Running Module : Optimize-Offline 4.0.1.7
    Optimize Start : 12/01/2020 01:30:56 PM
    Identity Name  : W0LF
    Computer Name  : DESKTOP-XXXXXXX
    ***************************************************************************************************
    
    2020-12-01T13:30:56 [INFO]: Supported Image Build: [20262]
    2020-12-01T13:30:59 [INFO]: Mounting Windows 10 Enterprise
    2020-12-01T13:32:19 [INFO]: Pre-Optimization Image Health State: [Healthy]
    
    ... leaving out the boring bits [App Removals]
    
    2020-12-01T13:42:05 [INFO]: Integrating the Win32 Calculator.
    2020-12-01T13:42:09 [INFO]: Applying Optimized Registry Settings.
    2020-12-01T13:42:24 [INFO]: Applying Setup Content.
    2020-12-01T13:42:27 [INFO]: Importing Registry Template: Additional Tweaks.reg
    2020-12-01T13:42:34 [INFO]: Cleaning-up the Start Menu Layout.
    2020-12-01T13:42:42 [INFO]: Post-Optimization Image Health State: [Healthy]
    2020-12-01T13:42:45 [INFO]: Saving and Dismounting Windows 10 Enterprise
    2020-12-01T13:44:38 [INFO]: Rebuilding and Exporting Windows 10 Enterprise using Fast compression.
    2020-12-01T13:46:50 [INFO]: Finalizing Optimizations.
    2020-12-01T13:46:50 [INFO]: Optimize-Offline completed in [16] minutes with [0] errors.
    
    ***************************************************************************************************
    Optimizations Finalized : 12/01/2020 01:46:50 PM
    ***************************************************************************************************
    
    en-GB OS