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

    drew84 MDL Expert

    Mar 13, 2014
    1,396
    2,376
    60
    Would appreciate notes on Driver integration (Can't get this to work,.. at least not the way I want it to)...

    I use DoubleDriver to export all non-microsoft drivers (on current OS) to named individual folders containing .inf files
    Driver packages always fails to integrate when placing these folders into their respective areas (within the script project)
    Extracting the contents of these folders into their respective areas... is a no go, as I would end up with a number of conflicts (same file names)

    Not a major issue (just inconvenient) as, can call the backup utility via setupcomplete.cmd
     
  2. KedarWolf

    KedarWolf MDL Addicted

    Mar 17, 2016
    977
    874
    30
    Make a folder D:\Drivers

    And run in an Admin PowerShell.

    Code:
    Export-WindowsDriver -Online -Destination D:\Drivers
    This only works on Windows 10 if you already have all your O/S drivers installed.

    Copy ALL the files it creates, not just the .inf files to your OO driver folders.

    For Windows 11 you need to run the command line version of that command.

    Code:
    dism /online /export-driver /destination:D:\Drivers
    Code:
                    Integrated Drivers (Install)
    
    ProviderName                 ClassName       Version        BootCritical
    ------------                 ---------       -------        ------------
    Advanced Micro Devices       System          1.0.0.80               True
    Advanced Micro Devices       System          1.0.0.82               True
    Advanced Micro Devices       System          1.0.0.83               True
    Advanced Micro Devices Inc.  SecurityDevices 4.16.0.0               True
    Advanced Micro Devices Inc.  SecurityDevices 4.13.0.0               True
    Advanced Micro Devices, Inc  System          2.2.0.130              True
    Advanced Micro Devices, Inc  System          5.12.0.38              True
    Advanced Micro Devices, Inc. System          2.0.1.0                True
    ASUSTeK Computer Inc.        Mouse           1.0.31.0               True
    ASUSTeK Computer Inc.        Keyboard        1.0.20.0               True
    A-Volute                     Extension       1.1.43.0              False
    BenQ                         Monitor         1.0.0.0               False
    cFos Software GmbH           NetService      11.10.2483.0          False
    Corsair Components, Inc.     USB             3.3.0.0                True
    Intel Corporation            Bluetooth       22.10.0.2             False
    Logitech                     System          2021.1.1365.0          True
    Logitech                     HIDClass        2021.1.1365.0          True
    Microsoft                    Printer         10.0.19041.1          False
    Microsoft                    Printer         10.0.18362.1          False
    Microsoft                    Printer         10.0.22000.1          False
    Nahimic                      MEDIA           8.51.48.758           False
    NVIDIA                       Display         30.0.14.7122          False
    NVIDIA                       MEDIA           1.0.0.5               False
    NVIDIA                       Display         27.21.14.6677         False
    NVIDIA Corporation           MEDIA           1.3.38.60             False
    Realtek                      Net             10.47.121.2021        False
    Realtek                      Net             10.50.511.2021        False
    Realtek                      Net             10.48.315.2021        False
    Realtek Semiconductor Corp.  MEDIA           6.0.9132.1            False
    Realtek Semiconductor Corp.  MEDIA           6.0.9151.1            False
    Samsung                      Monitor         1.0.0.0               False
    TAP-Windows Provider V9      Net             9.24.2.601            False
    Xbox                         HSM             10.0.19041.20         False
    Xbox                         SCSIAdapter     10.0.19041.18          True
    Xbox                         SCSIAdapter     10.0.19041.19          True
    Xbox                         HSM             10.0.19041.14         False
    
    
    
     
  3. Mavericks Choice

    Mavericks Choice MDL Guru

    Aug 5, 2015
    3,324
    13,923
    120
    I just backup all my 3rd party drivers from a live working Win 10 or 11 OS & place them in the additional/drivers folder in OO.
     
  4. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,396
    2,376
    60
    ... many thanks

    Some findings... On Win11 b.120 (running in VMware and updated via WU) these additional apps are present

    "Microsoft.UI.Xaml.2.3",
    "Microsoft.Winget.Source",
    "MicrosoftTeams",

    - not present in b.100 when running ./Start-Optimize populateLists

    and surprisingly when running an Online script on b.120 "NcsiUwpApp" is listed as 'Can Not Be Removed'
     
  5. brother it or any systemapp Can be removed easily via online system .
    User have to tweak srdrepository sql database then drop down all triggers set on paclage family row then set isinbox to 0 : then executing appxpackage removal powershell script does the job like a charm.
     
  6. spanishfly

    spanishfly MDL Senior Member

    Dec 5, 2018
    365
    540
    10
    I got the "executing appxpackage removal powershell script" part
    Code:
    Get-AppxPackage | Out-GridView -Passthru | Remove-AppXPackage
    But I'm a bit lost on the how to: "tweak srdrepository sql database then drop down all triggers set on paclage family row then set isinbox to 0"
    Google isn't helping me here. . .
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Mavericks Choice

    Mavericks Choice MDL Guru

    Aug 5, 2015
    3,324
    13,923
    120
    Code:
    Packages blacklist & whitelist, you can as ususal use the populateLists parameter to as well populate ./TemplateLists/Packages.json and cherry pick your packages
    Testing with Win 11, tried the populate list function calling by
    Code:
    PowerShell -NoExit C:\Users\MC\Desktop\Optimize-Offline-master-win11\Start-Optimize populateLists
    
    It runs OO & I checked the lists folder though templates were not populated?
    Any more info with this?
     
  8. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,396
    2,376
    60
    This thread covers a lot of it (includes video), for 1809 but the principle should be the same... also includes @BAU's ForceAppxUninstall alternative solution
     
  9. KedarWolf

    KedarWolf MDL Addicted

    Mar 17, 2016
    977
    874
    30
    I was wrong. I had a script-breaking comma on the last entry in packages json, now packages removal is working right. :/
     
  10. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,396
    2,376
    60
    ... which is now commonly known as doing an ashish, happened to me with my capabilities list... drove me mental
     
  11. i already have a solution for win10 as well as (fake win10) ie - win11 in my tweaking script $OEM$ pack which is dropped down on MDL since i have been banned here & i removed everything even changed the topic title to removed. i or wilenty or drew84 can help you in this. drew84 always been a great support for me in this for always testing the packs & wilenty always modding the scripts to be more user friendly. Both wilenty & drew84 knows much more then me in my own written script codes for win10 tweaking.
     
  12. spanishfly

    spanishfly MDL Senior Member

    Dec 5, 2018
    365
    540
    10
    I made an attempt at modifying "Optimize-Offline\Src\Public\New-ISOMedia.ps1"
    I got as far as what I think are the correct variables
    Code:
    $dir=$WorkFolder
    $iso=$ISOFile.FullName
    I think you then just need to use the "$dir2iso=@ . . ." part of @BAU powershell snippet alternative.
    Unfortunately, my PowerShell skills aren't good enough to make it work.
    Anyway, it doesn't really matter since OSCDIMG is a great solution. It was more of a personal attempt at seeing if I could cobble it together.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. spanishfly

    spanishfly MDL Senior Member

    Dec 5, 2018
    365
    540
    10
    thanks for sharing that. I'm looking at your "1-RemoveApps.cmd" and "2-Privacy.cmd". So much goodness!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. gdeliana

    gdeliana MDL Senior Member

    Oct 2, 2010
    365
    428
    10
    Actually if you look closer at the code of New-ISOMedia.ps1 is the same solution as proposed by @BAU with some adaptations to the local code of course. The script creates an ISO, and the files are correct, but the image is not bootable.
     
  15. gdeliana

    gdeliana MDL Senior Member

    Oct 2, 2010
    365
    428
    10
    #1157 gdeliana, Aug 7, 2021
    Last edited: Aug 7, 2021
    Will give this one a try, actually the GPU drivers no matter what, were always installed in the background (at least Nvidia drivers). Will test with the added reg key if this solves.
     
  16. gdeliana

    gdeliana MDL Senior Member

    Oct 2, 2010
    365
    428
    10
    Nice nice, will definitely give this one a try. very important one :rolleyes:
     
  17. spanishfly

    spanishfly MDL Senior Member

    Dec 5, 2018
    365
    540
    10
    Yes, oscdimg.exe never fails. It would be great if Microsoft allowed greater flexibility in it's use beyond their officially approved ADK package. Oh well. o_O
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. AveYo

    AveYo MDL Expert

    Feb 10, 2009
    1,836
    5,727
    60
    #1160 AveYo, Aug 7, 2021
    Last edited: Aug 7, 2021
    Made me curious and checked it out: sorry, but that's inaccurate, mine is not the same with that old unsafe code prone to memory leaks and race conditions ;)

    to integrate mine in ps1 scripts, just define the function somewhere:
    Code:
    function :DIR2ISO ($dir, $iso) { if (!(test-path -Path $dir -pathtype Container)) {"[ERR] $dir\ :DIR2ISO";exit 1}; $dir2iso=@"
     using System; using System.IO; using System.Runtime.Interop`Services; using System.Runtime.Interop`Services.ComTypes;
     public class dir2iso {public int AveYo=2021; [Dll`Import("shlwapi",CharSet=CharSet.Unicode,PreserveSig=false)]
     internal static extern void SHCreateStreamOnFileEx(string f,uint m,uint d,bool b,IStream r,out IStream s);
     public static void Create(string file, ref object obj, int bs, int tb) { IStream dir=(IStream)obj, iso;
     try {SHCreateStreamOnFileEx(file,0x1001,0x80,true,null,out iso);} catch(Exception e) {Console.WriteLine(e.Message); return;}
     int d=tb>1024 ? 1024 : 1, pad=tb%d, block=bs*d, total=(tb-pad)/d, c=total>100 ? total/100 : total, i=1, MB=(bs/1024)*tb/1024;
     Console.Write("{0,3}%  {1}MB {2}  :DIR2ISO",0,MB,file); if (pad > 0) dir.CopyTo(iso, pad * block, Int`Ptr.Zero, Int`Ptr.Zero);
     while (total-- > 0) {dir.CopyTo(iso, block, Int`Ptr.Zero, Int`Ptr.Zero); if (total % c == 0) {Console.Write("\r{0,3}%",i++);}}
     iso.Commit(0); Console.WriteLine("\r{0,3}%  {1}MB {2}  :DIR2ISO", 100, MB, file); } }
    "@; & { $cs=new-object CodeDom.Compiler.CompilerParameters; $cs.GenerateInMemory=1 #,# no`warnings
     $compile=(new-object Microsoft.CSharp.CSharpCodeProvider).CompileAssemblyFromSource($cs, $dir2iso)
     $BOOT=@(); $bootable=0; $mbr_efi=@(0,0xEF); $images=@('boot\etfsboot.com','efi\microsoft\boot\efisys.bin') #,# efisys_noprompt
     0,1|% { $bootimage=join-path $dir -child $images[$_]; if (test-path -Path $bootimage -pathtype Leaf) {
     $bin=new-object -ComObject ADODB.Stream; $bin.Open(); $bin.Type=1; $bin.LoadFromFile($bootimage)
     $opt=new-object -ComObject IMAPI2FS.BootOptions; $opt.AssignBootImage($bin.psobject.BaseObject); $opt.Manufacturer='Microsoft'
     $opt.PlatformId=$mbr_efi[$_]; $opt.Emulation=0; $bootable=1; $BOOT += $opt.psobject.BaseObject } }
     $fsi=new-object -ComObject IMAPI2FS.MsftFileSystemImage; $fsi.FileSystemsToCreate=4; $fsi.FreeMediaBlocks=0
     if ($bootable) {$fsi.BootImageOptionsArray=$BOOT}; $CONTENT=$fsi.Root; $CONTENT.AddTree($dir,$false); $fsi.VolumeName='DVD_ROM'
     $obj=$fsi.CreateResultImage(); [dir2iso]::Create($iso,[ref]$obj.ImageStream,$obj.BlockSize,$obj.TotalBlocks) };[GC]::Collect()
    } $:DIR2ISO: #,# export directory as (bootable) udf iso - lean and mean snippet by AveYo, 2021
    
    and then call it like this:
    Code:
    :DIR2ISO "ISOFOLDER" "folder.iso"
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...