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 Member

    May 14, 2016
    120
    25
    10
    After all 4.0.1.7 supports 19042
     
  2. stan456

    stan456 MDL Novice

    Jul 29, 2015
    9
    0
    0
    Not when I try it. Says build 19402 is not a supported build
     
  3. drew84

    drew84 MDL Addicted

    Mar 13, 2014
    824
    1,297
    30
    Covered Here,... script will work on Build 21301 (if you are prepared to do the work - not really that difficult)
     
  4. stan456

    stan456 MDL Novice

    Jul 29, 2015
    9
    0
    0
    works! thank you
     
  5. zbigniew59

    zbigniew59 MDL Member

    May 14, 2016
    120
    25
    10
    Does the file - Set-Additional.ps1 - make a copy of the org settings?
    If so, where and how to restore these org settings?
    Now, to restore org settings, I have to reinstall the system - I don't know how to restore these org settings.
     
  6. mR0463

    mR0463 MDL Novice

    Feb 1, 2021
    3
    0
    0
    Code:
     # Before stopping and disabling any Scheduled Task, export their default values as a JSON file. This way we can revert any change back to default if required.
                Get-ScheduledTask | Select-Object -Property TaskName, Description, TaskPath, State | ForEach-Object -Process { [PSCustomObject] @{ TaskName = $PSItem.TaskName; Description = $PSItem.Description; TaskPath = $PSItem.TaskPath; State = $PSItem.State; SetState = 'Disabled' } } | ConvertTo-Json | Out-File -FilePath .\DefaultScheduledTasks.json
    Line 27 to 29 seems to exactly do that, if I am not mistaken. What I don't know is if there is a script to revert the saved default settings.

    EDIT: Lines 38 to 40 do the same for services.
     
  7. drew84

    drew84 MDL Addicted

    Mar 13, 2014
    824
    1,297
    30
    #747 drew84, Feb 3, 2021
    Last edited: Feb 3, 2021
    If you Copy and Rename DefaultScheduledTasks.json to ScheduledTasks.json and replace the one in the setup folder
    Surely all you would then have to do is run Set-Additional.ps1 again (Online) to restore Defaults,... just a guess
     
  8. mR0463

    mR0463 MDL Novice

    Feb 1, 2021
    3
    0
    0
    That sounds pretty reasonable.
    Other question in that direction: Are these scripts (Set-Additional and Remove-OneDrive) supposed to be executed after system installation? I read the code and could not find any connection to the main scripts which are executed during optimization.
     
  9. drew84

    drew84 MDL Addicted

    Mar 13, 2014
    824
    1,297
    30
    #749 drew84, Feb 3, 2021
    Last edited: Feb 3, 2021
    Indeed

    Applied via Configuration.json
    Code:
     "Additional": {
        "Setup": true,
    
    also... it goes without saying that
    ScheduledTasks.json, Services.json, Set-Additional.ps1 and SetupComplete.cmd
    all need to be examined and edited to suit your own personal requirements, prior to running the script.
     
  10. geepnozeex

    geepnozeex MDL Novice

    Oct 21, 2014
    7
    1
    0
  11. mR0463

    mR0463 MDL Novice

    Feb 1, 2021
    3
    0
    0
    #752 mR0463, Feb 15, 2021
    Last edited: Feb 15, 2021
    I encountered the same problem - does anybody have an idea? I can confirm that it has something to do with Set-Additional.ps1 - I have just restored my VM to an earlier state and it is working again. I'll try to find out myself where the problem is once I have some free time.

    EDIT: I just noticed that this has been partly answered before: It is WpnUserService in line 59 of Set-Additional.ps1 which you need to comment out.
    If you want to quickly reverse the change, you can enter the following into an elevated PowerShell prompt:

    Code:
    Get-ChildItem -Path "HKLM:\SYSTEM\CurrentControlSet\Services" | Where-Object -Property Name -Like *WpnUserService* | Set-ItemProperty -Name Start -Value 2 -Force -PassThru | Set-ItemProperty -Name UserServiceFlags -Value 3 -Force
    Afterwards, it was working normally again for me.
     
  12. SerpentDash

    SerpentDash MDL Novice

    Jul 17, 2019
    3
    0
    0
    Hi.
    Is there any way to implement onedrive Remove-OneDrive.ps1 and/or Set-Additional.ps1 to be executed in SetupComplete.cmd?
    Every time I want to to this, setup is 'corupted'. I know that commands in SetupComplete shouldn't give any output so I edited powershell scripts to not show / ask anything user but it's still not working. Redirecting output to nul not helps at all.
     
  13. zbigniew59

    zbigniew59 MDL Member

    May 14, 2016
    120
    25
    10
    #754 zbigniew59, Feb 17, 2021
    Last edited: Feb 17, 2021
    You need to run this as administrator after installation.
    Path C: Windows / Setup / Scripts

    SetupComplete does this - you don't need to do anything in the scripts.

    Applied via Configuration.json

    "Additional": {
    "Setup": true,
    # 749 - read on
     
  14. SerpentDash

    SerpentDash MDL Novice

    Jul 17, 2019
    3
    0
    0
    Yeah I understand that...
    I'm just trying to execute those in SetupComplete.cmd
     
  15. drew84

    drew84 MDL Addicted

    Mar 13, 2014
    824
    1,297
    30
    ...Think that was covered here
     
  16. yatopp

    yatopp MDL Novice

    Jul 17, 2011
    30
    9
    0
    I tried it like that, but I had issues to what SerpentDash is talking about - setup is 'corupted'. So left my SetupComplete.cmd without a call to Set-Additional.ps1 and there was no error in setup. I just executed it after installation.