Coder Social home page Coder Social logo

drempiricism / optimize-offline Goto Github PK

View Code? Open in Web Editor NEW
705.0 37.0 66.0 2.74 GB

Optimize-Offline is a Windows 10 offline image optimization framework.

License: MIT License

Batchfile 0.68% PowerShell 99.32%
wim ltsc2019 1809 1903 windows10 image-customization esd 1909 2004 debloat

optimize-offline's Introduction

Optimize-Offline

Optimize-Offline is a Windows Image (WIM/ESD) optimization module designed for Windows 10 versions 1803-to-2009 64-bit architectures.

About Optimize-Offline

  • Expands the user experience by eliminating unnecessary bloat, enhancing privacy, improving aesthetics and increasing system performance.
  • Accepts either a full Windows 10 Installation Media ISO, Windows 10 WIM, SWM or ESD file.
  • Does not perform any changes to a live system or running environment.
  • Checks the integrity and health of the image both before and after optimizations are processed to ensure the image retains a healthy status.
  • Allows for the deprovisioning and removal of Provisioned Application Packages, System Applications, Capability Packages, Windows Cabinet Package Files, Optional Features and more.
  • Detects what Provisioned and System Applications were removed and further cleans-up any associated drivers, services and integrated content associated with them.
  • Allows for the integration of drivers, Microsoft DaRT 10, Windows Store, Microsoft Edge, Developer Mode, Win32 Calculator, Data Deduplication and more.
  • All optimization processes are done silently with internal error-handling.
  • All images are optimized independently - without the need for 3rd party programs - by utilizing custom module resources.

Module Disclaimer

  • The latest releases of Optimize-Offline can be found here.
  • It is the responsibility of the end-user to be aware of what each parameter value does, which are all well documented in the Module Help Topics and Optimization Details.
  • Optimize-Offline is designed to optimize OEM images and not images already optimized by another script or program.
  • Optimize-Offline is designed for an en-US host environment.
  • Just because something can be removed does not mean it should be removed. Haphazard removal of packages or features can prevent Windows 10 Setup from completing or cause runtime errors.
  • Support will not be given to users who attempt to optimize unsupported builds, previously modified images or modify the default code to circumvent edition requirements.

Optimize-Offline Best Practices

  • Before optimizing an image, read the Module Help Topics and Optimization Details.
  • Keep the project file stucture in its default state.
  • Only OEM images should be used for optimization and not images that have already been modified by other scripts or programs.
  • If maintaining fully updated OEM images, it is best to integrate offline updates into the image BEFORE running Optimize-Offline.
  • Do not run any other programs or scripts - or manually run commands - that can interact with either the working directories of the module or the registry while optimizations are processing.

Parameters

About System Applications

System Applications are a lot like Provisioned Application Packages (Windows Apps) in respect that they are provisioned and installed during the setup of Windows. During the Windows Setup component pass, setup looks for these System Applications in the default registry and provisions them for installation only if their entries are present. By removing these entries, Windows Setup does not provision them for installation.

This method is safer than force removing the System Application using its component package because it retains the default file structure. Furthermore, the force removal of System Applications' component packages can trip the dreaded "STATUS_SXS_COMPONENT_STORE_CORRUPT" flag. This is a critical component store corruption flag that will then be detected by any servicing command and Windows Update and prevents both the servicing and updating of the Operating System. The only way to remedy and fix this error is to re-install or reset the Operating System.

System Applications universally safe to remove

The following System Applications are safe to remove:

  • BioEnrollment (provided no biometrics will be used)
  • CallingShellApp (provided no mobile phone will be linked to the device)
  • MicrosoftEdge (has been replaced by Microsoft Edge Chromium, which is detailed more below)
  • MicrosoftEdgeDevToolsClient
  • PPIProjection
  • SecHealthUI
  • ContentDeliveryManager
  • FileExplorer
  • NarratorQuickStart
  • ParentalControls
  • SecureAssessmentBrowser
  • XGpuEjectDialog
  • XboxGameCallableUI (provided no integrated Xbox gaming features will be used)
  • UndockedDevKit
  • NcsiUwpApp

Cortana can also be removed, though doing so will render the default search feature inoperable and is only recommended if a 3rd party search program like Classic Shell will be used.

AppResolverUX is a UWP app that not only issues the pop-up asking how to open a specific file that does not have its own dedicated app association, but also allows for the installation of DHC drivers. It is advised not to remove this System Application as doing so will prevent all Store, UWP/DHC driver apps from running and also prevent them from being manually installed.

Some System Applications are required during the OOBE setup pass and their removal can cause setup to fail. Do not remove any System Application if you're unsure of its impact on a live system.

About Windows Capabilities and Packages

The Capabilities parameter allows for the removal of Features on Demand (FOD) installed in the image and the Packages parameter allows for the removal of Windows Cabinet File Packages.

Like with all removals, care must be taken when using either of these removal parameters, particularly the Packages parameter. Do not remove any Capability or Package if you are unaware of its impact on a live installation. It is recommended to read the Features on Demand Document to better understand their functions.

About Registry Optimizations

The Registry parameter applies an array of entries and values to the image registry hives designed to further enhance both the security of the default image as well as its usability and aesthetics. The module only applies those registry entries and values applicable to the image build being optimized and bypasses those that are unsupported. Likewise, Optimize-Offline will apply additional entries and values to accommodate any application removal or integration. Optimize-Offline does not apply any Group Policy entries that are not available in the specific image edition by default, as this would just add unnecessary bloat to the registry itself with zero functionality.

A short list of some of the optimizations include:

  • Completely disables Cortana without disabling the default search feature.
  • Disables history collection and Bing Search integration by the default search feature.
  • Disables a significant amount of telemetry, logging, tracking, monitoring and background feedback submission.
  • Prevents bloatware link creation and disables a plethora of annoying default features.
  • Disables Windows' annoying pop-up notifications and tips.
  • Disables non-explicit application and system location sensor access.
  • Disables background error reporting and its automatic synchronization to Microsoft.
  • Disables the automatic creation of tabs and icons for Microsoft Edge.
  • Disables intrusive Microsoft feedback and notification queries.
  • Cleans-up the default Context Menu.

About the SMB1 File Sharing Protocol and Windows PowerShell 2.0 Optional Features

When optimizing an image with Optimize-Offline, curiosity may arise as to why the SMB1 Protocol and Windows PowerShell 2.0 Optional Features are automatically disabled. In short, Microsoft has labled both of them a security risk.

About Additional Content

When the Additional parameter is used, user-specific content added to the "Content/Additional" directory will get integrated into the image when enabled within the hashtable. This eliminates the need to use an external Distribution Share.

All content that gets transfered to the image are copied to locations that are in accordance with Microsoft's deployment guidelines. For example, any system logo is copied to '\Windows\System32\oobe\info\logo', wallpaper is copied to '\Windows\Web\Wallpaper', setup content is copied to '\Windows\Setup\Scripts' and an unattend.xml is copied to '\Windows\Panther' after it is applied to the image itself (this is detailed more below).

Content can be in the form of files, folders or directories, unless a specific filetype is required. Content is NOT copied haphazardly nor are original file structures ignored.

Registry Template Integration

Any custom registry template (.reg) file to be imported into the offline image's registry hives can be placed in the '\Content\Additional\RegistryTemplates' folder. No editing of these template files is required and Optimize-Offline will copy and edit them accordingly to apply them to the appropriate hives.

Adding Drivers

Any driver package to be injected into the offline image can be placed in its respective folder in the '\Content\Additional\Drivers' directory. Within this directory you can select whether a driver package is added to just the Windows Installation, or also to the Windows Setup and Windows Recovery environments. Either single .inf files or full driver packages are supported.

Adding an Answer File

When an unattend.xml answer file is added to the '\Content\Additional\Unattend' folder, Optimize-Offline applies the answer file directly to the image, creates the '\Windows\Panther' directory within the image and finally copies the answer file to it. "Panther" was the code-name for a servicing and setup engine that began with Windows Vista and has remained as such since.

During Windows installation, Windows Setup automatically looks for answer files in specific locations for custom installations. The %WINDIR%\Panther directory and the installation media are the first locations checked for an answer file. An unattend.xml that gets applied directly to the image, and is located in the %WINDIR%\Panther directory, will act identically to an autounattend.xml placed on the installation media does with the exception of the WindowsPE configuration pass. Since the WindowsPE configuration pass configures disk partitions and layouts, an answer file containing these parameters must be placed in an autounattend.xml. Additionally, you can use multiple answer files to setup Windows by applying an unattend.xml to the image and adding an autounattend.xml to the installation media. For example, the unattend.xml applied to the image can contain OOBE and Windows Setup parameters while the autounattend.xml can contain only parameters for the WindowsPE pass that sets up the partitions and disk layouts for installation.

It is highly recommended to create any answer files using the Windows System Image Manager that is included in the Windows ADK. Though there are some online answer file generators that will "quickly" create an answer file for you, answer file parameters and variables can change between builds. Likewise, having faulty or unsupported parameters and/or variables in an answer file can prevent Windows Setup from completing.

It is also in good practice to have a good idea what each configuration pass does and what actions its child parameters takes during the Windows setup process. All information regarding Configuration Passes can be found in the Microsoft Document

Having incorrect, null or incomplete values in your answer file, most notably the WindowsPE Configuration Pass, WILL prevent Windows from completing its setup or even starting its setup. If a custom disk layout is included for installation, make certain the proper drive index numbers, partition type IDs and sizes are entered.

About Microsoft DaRT 10

With Optimize-Offline, the Microsoft 10 Diagnostic and Recovery Toolset and the Windows 10 Debugging Tools can be integrated into Windows Setup and/or the Windows Recovery allowing for the troubleshooting of system issues from a Preinstallation Environment. Likewise, it is NOT recommended to integrate Microsoft DaRT 10 into images accessible by multiple people or the default Recovery Environement because any user will be able to attain access to these tools by rebooting the device into Windows Recovery. Only integrate Microsoft DaRT 10 into the default Recovery Environment if the device will require specific credentials to gain access to the Operating System and the ability to reboot into the Recovery Environment is removed from the log-in screen using Group Policy.

It is also recommended to be well versed and aware of all recovery tools Microsoft DaRT 10 supplied prior to integrating it into the image(s) by thoroughly reviewing the Microsoft DaRT 10 Microsoft Document

Microsoft Diagnostics and Recovery Toolset (DaRT) 10 lets you diagnose and repair a computer that cannot be started or that has problems starting as expected. By using DaRT 10, you can recover end-user computers that have become unusable, diagnose probable causes of issues, and quickly repair unbootable or locked-out computers. When it is necessary, you can also quickly restore important lost files and detect and remove malware, even when the computer is not online. Microsoft Document

About Win32Calc

Starting in Windows 8.1, Microsoft introduced a Metro-style calculator to replace its traditional Calculator. In Windows 10 non-LTSB/LTSC/Server editions, the traditional Calculator was entirely removed and replaced with a UWP (Universal Windows Platform) App version. This new UWP Calculator introduced a fairly bloated UI many users were simply not fond of and much preferred the simplicity of the traditional Calculator (now labeled Win32Calc.exe). Unfortunately, Microsoft never added the ability to revert back to the traditional Calculator nor released a downloadable package to install the traditional Calculator.

About Data Deduplication

Data Deduplication, often called Dedup for short, is a feature of Windows Server 2016 that can help reduce the impact of redundant data on storage costs. When enabled, Data Deduplication optimizes free space on a volume by examining the data on the volume by looking for duplicated portions on the volume. Duplicated portions of the volume's dataset are stored once and are (optionally) compressed for additional savings. Data Deduplication optimizes redundancies without compromising data fidelity or integrity. Microsoft Document

With Optimize-Offline, the Data Deduplication packages can be integrated into the offline image. PowerShell's storage cmdlets can then be used to enable and manage Data Deduplication after the optimized image has been installed. More information is available from its Microsoft Document

About Developer Mode

Developer Mode is a Windows Setting that, when enabled, allows the end-user to test any unsigned UWP app, use the Ubuntu Bash shell environment and offers optimizations for Windows Explorer, Remote Desktop and PowerShell. It is also a requirement when writing certain code in Visual Studio.

Enabling Developer Mode also installs Device Portal and Device Discovery, though they must be manually toggled on in the Settings in order for them to be enabled. Enabling Device Portal will reconfigure the default firewall rules to allow incoming connections, as Device Portal is a feature allowing for the system to act as a local web server for other devices on the local network. This is used for developing, deploying and debugging apps. Enabling Device Discovery allows devices to pair with Device Portal.

Developer Mode should ONLY be enabled on systems that require settings it provides. More information is available from its Microsoft Document

Integrating Windows Store

For Windows 10 Enterprise LTSC 2019, the latest Windows Store package bundles and dependency packages can be integrated into the image, as this flavor of Windows (like Windows 10 Enterprise LTSB 2015-2016) does not contain any Windows Apps in its OEM state. There is no additional procedure required once the optimized Windows 10 LTSC 2019 is installed, and the Windows Store will be displayed in the Start Menu.

Integrating Microsoft Edge HTML

For Windows 10 Enterprise LTSC 2019, Microsoft's flagship browser - Microsoft Edge (HTML-based) - can be integrated into the image since this flavor of Windows (like Windows 10 Enterprise LTSB 2015-2016) does not contain Microsoft Edge in its OEM state.

Integrating Microsoft Edge Chromium

Microsoft Edge Chromium was publicly released on January 15, 2020 and runs on the same Chromium web engine as the Google Chrome browser. Microsoft Edge Chromium is designed to replace the Microsoft Edge (HTML-based) system application. Moreover, the Microsoft Edge system application can be removed while still allowing for the usage of Microsoft Edge Chromium.

For Windows 10 builds 18362 and above, the new Microsoft Edge Chromium browser can be integrated into the image. When the Microsoft Edge Chromium browser is integrated into an image, Optimize-Offline will also apply its administrative policy templates for GPO (Group Policy) control of its functions and features.

Solid Image Compression

Solid image compression uses the undocumented LZMS compression format to concatenate all file data within a regular WIM file into a solid WIM archive (ESD file). By doing this, a 4GB WIM file is able to be compressed to a size of 2GB or less. However, as with other forms of high-ratio compression, LZMS compression can take quite a while to complete and is extremely system intensive. Solid compression should NOT be selected as the final image compression type if the end-user is impatient or has limited system resources.

ISO File Structure Optimization

This is a process that occurs automatically when a Windows Installation ISO is used as the source image for optimization. In short, it removes all unnecessary media files used to install Windows 10 from a live system, thus reducing the total size of the installation media. The order in which files are removed and moved is critical for proper file structuring.

ISO Remastering and Creation

When a Windows Installation Media ISO is used as the source image for optimizing, Optimize-Offline expands the entire media structure of the ISO into its own directory and allows for the creation of a new bootable Windows Installation Media ISO containing the newly optimized Windows Image after all processes have completed.

The ISO parameter allows for two values to be passed to it: 'Prompt' and 'No-Prompt.' This value sets the binary bootcode the image will be created with. An ISO created with the 'No-Prompt' bootcode will not require a keypress to begin Windows Setup allowing for a completely unattended Windows installation, while an ISO created with the 'Prompt' bootcode will require a keypress before Windows Setup will start.

Optimize-Offline calls the COM IMAPI2 interface for file system image building and also opens a binary stream that writes a bootfile sector code to the ISO. This allows for bootable Windows Installation Media ISO creation without the need for 3rd party tools like oscdimg.

About Defaultuser0

Any time an OEM Windows Image is modified offline, or the System Preparation, Reset and Provisioning Package deployment features are used, there is a chance this ghost account will surface. defaultuser0 is not a real account, however, and is a bug that has been present in Windows through countless flavors and variations. It is not added to any user groups nor does it even have a profile. Conversely, failing to remove the defaultuser0 account immediately after Windows Installation completes can lead to future headaches. As an example, if you reset Windows with the defaultuser0 ghost account still present, upon the restart of the device, Windows will force you to log into the defaultuser0 account to continue.

In earlier versions of Optimize-Offline, a specific registry key was appended to allow for elevated control over the defaultuser0 account which allowed for its manual removal, as well as a SetupComplete.cmd script code that automatically removed it. However, with the newer builds (17134+), this is no longer required and simply rebooting the newly installed OS will automatically remove the defaultuser0 account from the 'Users' directory without having to manually remove it.

Using Optimize-Offline

Open the custom configuration JSON file (Configuration.json) in any text editing program and edit any values for your specific optimization requirements. While editing the Configuration.json file, do not change the template structure and make sure its formatting is retained when adding or changing values.

Once you have edited the Configuration.json to your specific optimization requirements, open an elevated PowerShell console in the root directory of the Optimize-Offline project and execute the Start-Optimize call script:

.\Start-Optimize.ps1

optimize-offline's People

Contributors

drempiricism avatar hanacchi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

optimize-offline's Issues

Permissions Issue On boot.wim

When I run the W10UI script from mydigitallife forums to integrate the updates I get the below error.

See the Access Is Denied errors.

If I give full Read and Write permissions to all the folders my extracted ISO is in and to the boot.wim I get only one Access Is Denied error there.

And yes, I copied all created folders and files from the 'Optimize-Offline-[10.26.18 12.51.45]' folder to my extracted ISO folder.

If I run the W10UI script on the extracted ISO folder without copying the Optimised-Offline created files and folders I get no Permission denied errors.

> Mounting boot.wim - index 2/2
> ============================================================
> 
> Deployment Image Servicing and Management tool
> Version: 10.0.17134.1
> 
> Mounting image
> [==========================100.0%==========================]
> The operation completed successfully.
> 
> ============================================================
> Checking Updates...
> ============================================================
> 
> ============================================================
> Installing servicing stack update...
> ============================================================
> 
> Deployment Image Servicing and Management tool
> Version: 10.0.17134.1
> 
> Image Version: 10.0.17763.1
> 
> Processing 1 of 1 - Adding package Package_for_KB4465477~31bf3856ad364e35~amd64~~17763.52.1.1
> [==========================100.0%==========================]
> The operation completed successfully.
> 
> ============================================================
> Installing updates...
> ============================================================
> 
> Deployment Image Servicing and Management tool
> Version: 10.0.17134.1
> 
> Image Version: 10.0.17763.1
> 
> Processing 1 of 1 - Adding package Package_for_RollupFix~31bf3856ad364e35~amd64~~17763.104.1.1
> [==========================100.0%==========================]
> The operation completed successfully.
> 
> ============================================================
> **Resetting WinPE image base
> ============================================================
> 
> Deployment Image Servicing and Management tool
> Version: 10.0.17134.1
> 
> Image Version: 10.0.17763.104
> 
> [===========================99.4%========================= ]
> The operation completed successfully.
> 
> Deployment Image Servicing and Management tool
> Version: 10.0.17134.1
> 
> Image Version: 10.0.17763.104
> 
**> [==========================100.0%==========================]
> The operation completed successfully.
> Access is denied.
> Access is denied.
> Access is denied.
> Access is denied.
> Access is denied.
> Access is denied.****
> 
> ============================================================
> Unmounting boot.wim - index 2/2
> ============================================================
> 
> Deployment Image Servicing and Management tool
> Version: 10.0.17134.1
> 
> Image File : D:\2\sources\boot.wim
> Image Index : 2
> Saving image
> [==========================100.0%==========================]
> Unmounting image
> [==========================100.0%==========================]
> The operation completed successfully.

Generate ISO failure

Great tool! I spent a few hours scratching my head as to why the ISO image was not being created. There were no errors so it appears it was skipping that step.

The following line seems to grab both instances/paths for Windows Kits:

$ADK_ROOT = @("HKLM:\Software\Wow6432Node\Microsoft\Windows Kits\Installed Roots", "HKLM:\Software\Microsoft\Windows Kits\Installed Roots") | ForEach {

Because of this, the following test fails:

If (Test-Path -Path "$($OSCDIMG)\oscdimg.exe")

Because OSCDIMG contains both paths. My fix was to just delete the second HKLM key and it worked as expected.

This was on Windows 10 v1803.

Missing Sharing card

Hi Dev. You version v3.1.3.0 have problem. Missing tab for Drive/Folder Sharing card in Properties dialog. Do you can fix this?

Spaces path

Randomly have problem if path is special charsets (diacritics, spaces, etc.).
I added to Start.cmd this code for check spaces only.

@ECHO OFF
CD /D "%~dp0"

REM Check path for spaces.
SET "THISDIR=%~dp0"
SET "THISDIR=%THISDIR:~0,-1%"
IF NOT "%THISDIR%"=="%THISDIR: =%"  (
    ECHO.
    ECHO.***************************************************************************************************
    ECHO.
    ECHO.    The path must not contain spaces!
    ECHO.
    ECHO.***************************************************************************************************
    ECHO.    Actually path is: [%THISDIR%]
    ECHO.***************************************************************************************************
    ECHO.
    PAUSE
    EXIT 1
)

REM After setting the SourcePath and SourceBuild variables, run this script as an administrator to quickly call Optimize-Offline without having to manually do it.
REM The variables carry over to the PowerShell script, as do the switches.

REM Start PowerShell Variables

...

ยฟError? with 3.1.3.5

Hi, editing an LTSC 1809 x64 iso all went well but ends with this (Error log is empty):

Applying Optimized Registry Settings.
Cleaning-up the Start Menu Layout Tiles.
Post-Optimization Image Health State: [Healthy]
Saving and Dismounting the Image.
Rebuilding and Exporting the Image.
Finalizing Optimizations.
ADVERTENCIA: Optimize-Offline completed in [22] minutes with [2] errors.
Remove-Variable : No puede quitarse la variable _ porque se optimizรณ y no es extraรญble. Intente usar el cmdlet
Remove-Variable (sin ningรบn alias) o use el operador punto con el comando que utiliza para quitar la variable.
En D:\Programas\W10CU\Optimize-Offline-master\Optimize-Offline.ps1: 2525 Carรกcter: 118

  • ... t $DefaultVariables).InputObject).ForEach{ Remove-Variable -Name $_ }
  •                                            ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (_:String) [Remove-Variable], SessionStateUnauthorizedAccessException
    • FullyQualifiedErrorId : VariableNotRemovableRare,Microsoft.PowerShell.Commands.RemoveVariableCommand

Remove-Variable : No puede quitarse la variable PSItem porque se optimizรณ y no es extraรญble. Intente usar el cmdlet
Remove-Variable (sin ningรบn alias) o use el operador punto con el comando que utiliza para quitar la variable.
En D:\Programas\W10CU\Optimize-Offline-master\Optimize-Offline.ps1: 2525 Carรกcter: 118

  • ... t $DefaultVariables).InputObject).ForEach{ Remove-Variable -Name $_ }
  •                                            ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (PSItem:String) [Remove-Variable], SessionStateUnauthorizedAccessException
    • FullyQualifiedErrorId : VariableNotRemovableRare,Microsoft.PowerShell.Commands.RemoveVariableCommand

Any ideas? Thanks.

Issue with the last 3.1.2.9 - 11/26/2018 version?

Hi, i was testing the lastest version (3.1.2.9 - 11/26/2018) with LTSC 2019, and im getting this error (with the 3.1.2.9 - 11/25/2018 version it didn't happen):

Applying the Microsoft Store Application Packages.
Applying the Microsoft Edge Browser Application Packages.
Applying Optimized Registry Settings.
Get-ItemProperty : No se encuentra la ruta de acceso 'HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' porque no existe.
En D:\Programas\W10CU\Optimize-Offline-master\Optimize-Offline.ps1: 2085 Carรกcter: 14

  • ... If ((Get-ItemProperty -LiteralPath "HKLM:\WIM_HKCU\SOFTWARE\Mi ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (HKLM:\WIM_HKCU...rentVersion\Run:String) [Get-ItemProperty], ItemNotFoundException
    • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

Generating a Setup Post-Installation Script.
Cleaning-up the Image.
Post-Optimization Image Health State: [Healthy]
Saving and Dismounting the Image.
Rebuilding and Exporting the Image.
Finalizing Optimizations.
ADVERTENCIA: Optimize-Offline completed in [12] minutes with [1] errors.

I think its an innocuous error, but i notify it anyway.

ChangeLog opposite statement?

As written: Made multiple changes and removals to registry settings applied, as many of them have changed and are not applicable to older builds. As such, Optimize-Offline no longer supports builds lower than RS4 (17134).

I assume you meant... "only applicable to older builds"

Black Box On Icons

After a clean install on Windows LTSC 2019, there is a black box on new program icons, not system icons though.

Fix is to use UWT 4.5 and remove shortcut arrows, then the black boxes are gone.

1809 Build 17763 SmartScreen still functions

I did some online research before posting this 'issue' so I'm fairly confident that this is new to build 17763. My prior Optimize-Offline 17134 build works as expected.

In build 17763, 'SmartScreen' (C:\windows\system32\smartscreen.exe) occasionally runs when starting an application.
My image used Optimize-Offline to successfully disabled Windows Defender and I've confirmed that all the "Removing Windows Defender Remnants" registry settings are still correctly applied.

If it turns out that I'm alone with this issue, than, please let me know so I can try and figure out if I've done something stupid.
Else, if this is a known problem, do you have a suggested solution?

Bad name WIM file

If source copy is not install.wim named then show error in cmd window:
WARNING: Cannot find path 'C:\Script\Temp_338209782\ImageOffline\install.wim' because it does not exist.
Press any key to continue . . .

and exiting script.

Component store corrupted files after OneDrive removal LTSC N

Optimize-Offline 3.1.1.9
Optimize-Offline.log
ErrorLog.log

From CBS.log after running "sfc /scannow":

2018-10-15 06:11:14, Info CSI 00004227 [SR] Repairing 5 components 2018-10-15 06:11:14, Info CSI 00004228 [SR] Beginning Verify and Repair transaction 2018-10-15 06:11:14, Info CSI 00004229 [SR] Cannot repair member file [l:35]'OneDriveSettingSyncProvider.dll.mui' of Microsoft-Windows-SettingSync-OneDrive.Resources, version 10.0.17763.1, arch amd64, culture [l:5]'en-US', nonSxS, pkt {l:8 b:31bf3856ad364e35} in the store, file is missing 2018-10-15 06:11:14, Info CSI 0000422a [SR] Cannot repair member file [l:31]'OneDriveSettingSyncProvider.dll' of Microsoft-Windows-SettingSync-OneDrive, version 10.0.17763.1, arch amd64, nonSxS, pkt {l:8 b:31bf3856ad364e35} in the store, file is missing 2018-10-15 06:11:14, Info CSI 0000422b [SR] Cannot repair member file [l:35]'OneDriveSettingSyncProvider.dll.mui' of Microsoft-Windows-SettingSync-OneDrive.Resources, version 10.0.17763.1, arch Host= amd64 Guest= x86, culture [l:5]'en-US', nonSxS, pkt {l:8 b:31bf3856ad364e35} in the store, file is missing 2018-10-15 06:11:14, Info CSI 0000422c [SR] Cannot repair member file [l:31]'OneDriveSettingSyncProvider.dll' of Microsoft-Windows-SettingSync-OneDrive, version 10.0.17763.1, arch Host= amd64 Guest= x86, nonSxS, pkt {l:8 b:31bf3856ad364e35} in the store, file is missing 2018-10-15 06:11:14, Info CSI 0000422d@2018/10/15:04:11:14.284 Primitive installers committed for repair 2018-10-15 06:11:14, Info CSI 0000422e [SR] Cannot repair member file [l:35]'OneDriveSettingSyncProvider.dll.mui' of Microsoft-Windows-SettingSync-OneDrive.Resources, version 10.0.17763.1, arch amd64, culture [l:5]'en-US', nonSxS, pkt {l:8 b:31bf3856ad364e35} in the store, file is missing 2018-10-15 06:11:14, Info CSI 0000422f [SR] This component was referenced by [l:160]'Microsoft-Windows-Client-Desktop-Required-Package0112~31bf3856ad364e35~amd64~en-US~10.0.17763.1.79560E53E6C40815588F39586316570908866C0CE065D0B9056A1089D5A7D14B' 2018-10-15 06:11:14, Info CSI 00004230@2018/10/15:04:11:14.300 Primitive installers committed for repair 2018-10-15 06:11:14, Info CSI 00004231@2018/10/15:04:11:14.300 Primitive installers committed for repair 2018-10-15 06:11:14, Info CSI 00004232 [SR] Cannot repair member file [l:35]'OneDriveSettingSyncProvider.dll.mui' of Microsoft-Windows-SettingSync-OneDrive.Resources, version 10.0.17763.1, arch Host= amd64 Guest= x86, culture [l:5]'en-US', nonSxS, pkt {l:8 b:31bf3856ad364e35} in the store, file is missing 2018-10-15 06:11:14, Info CSI 00004233 [SR] This component was referenced by [l:164]'Microsoft-Windows-Client-Desktop-Required-WOW64-Package00~31bf3856ad364e35~amd64~en-US~10.0.17763.1.530F42F0353C146E0D02DAA7596C46DC93498D4CE6DF5951DC199E58131AFBC9' 2018-10-15 06:11:14, Info CSI 00004234@2018/10/15:04:11:14.315 Primitive installers committed for repair 2018-10-15 06:11:14, Info CSI 00004235@2018/10/15:04:11:14.315 Primitive installers committed for repair 2018-10-15 06:11:14, Info CSI 00004236 [SR] Cannot repair member file [l:31]'OneDriveSettingSyncProvider.dll' of Microsoft-Windows-SettingSync-OneDrive, version 10.0.17763.1, arch amd64, nonSxS, pkt {l:8 b:31bf3856ad364e35} in the store, file is missing 2018-10-15 06:11:14, Info CSI 00004237 [SR] This component was referenced by [l:124]'Microsoft-Windows-Client-Desktop-Required-Package03115~31bf3856ad364e35~amd64~~10.0.17763.1.ae80f62a394dda63fbe1bd28782682dd' 2018-10-15 06:11:14, Info CSI 00004238@2018/10/15:04:11:14.315 Primitive installers committed for repair 2018-10-15 06:11:14, Info CSI 00004239@2018/10/15:04:11:14.331 Primitive installers committed for repair 2018-10-15 06:11:14, Info CSI 0000423a [SR] Cannot repair member file [l:31]'OneDriveSettingSyncProvider.dll' of Microsoft-Windows-SettingSync-OneDrive, version 10.0.17763.1, arch Host= amd64 Guest= x86, nonSxS, pkt {l:8 b:31bf3856ad364e35} in the store, file is missing 2018-10-15 06:11:14, Info CSI 0000423b [SR] This component was referenced by [l:161]'Microsoft-Windows-Client-Desktop-Required-WOW64-Package0015~31bf3856ad364e35~amd64~~10.0.17763.1.783B8463B14A2A46312BF826A3343766DDDACC42D15285C31B1702CCEAEE90EE' 2018-10-15 06:11:14, Info CSI 0000423c@2018/10/15:04:11:14.331 Primitive installers committed for repair 2018-10-15 06:11:14, Info CSI 0000423d [SR] Repairing corrupted file \??\C:\Windows\System32\\CompatTelRunner.exe from store 2018-10-15 06:11:14, Info CSI 0000423e@2018/10/15:04:11:14.409 Primitive installers committed for repair 2018-10-15 06:11:14, Info CSI 0000423f [SR] Repair complete

Language preferences missing from Settings/Control Panel

I actually haven't tested an untouched version of LTSC N 2019 yet, but for now I'm assuming it's related to your script: the language preferences are not available in Settings. Instead I'm redirected to the main Settings page upon selecting "Language preferences" from the Language bar in the taskbar. Also the "Clock and Region" settings in the old Control Panel applet is empty: "There are no items to display". The result is I'm not able to add or remove keyboard maps.

AFAIK, I did not remove any language related packages or features. Can you reproduce this? Perhaps one of the registry tweaks is responsible?

Version 3.1.1.9

Optimize-Offline.log
ErrorLog.log

Taskbar Settings icon

Taskbar Settings icon i dont can removing. After Explorer.exe restart (or PC restart) it is show now.

Dev, you have as default item in UserFolder. Do you can pin Settings on taskbar only?

Bad words

Gram error: you have Definitions as "Defintions" on two lines:
1.
Out-Log -Content "Disabling Windows Feature: Windows-Defender-Default-Defintions" -Level Info
2.
Out-Log -Content "Failed Disabling Windows Feature: Windows-Defender-Default-Defintions" -Level Error

Suggestion: New registry section to fully disable UAC & LUA

Hello, maybe you could add this section to your script with optional CLI switch, but if not then maybe someone will find it useful for forking:

CODE (CLICK ME)

#****************************************************************
Write-Output "Disabling UAC and Enabling Full Admin Rights." >>  "$WorkFolder\Registry-Optimizations.log"
#****************************************************************
New-Container -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -ErrorAction Stop
New-Container -Path "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -ErrorAction Stop
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorUser" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "dontdisplaylastusername" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableInstallerDetection" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableSecureUIAPaths" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableUIADesktopToggle" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableVirtualization" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "FilterAdministratorToken" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "scforceoption" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "shutdownwithoutlogon" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "undockwithoutlogon" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ValidateAdminCodeSignatures" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorUser" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "dontdisplaylastusername" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableInstallerDetection" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableSecureUIAPaths" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableUIADesktopToggle" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableVirtualization" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "FilterAdministratorToken" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "scforceoption" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "shutdownwithoutlogon" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "undockwithoutlogon" -Value 0 -Type DWord
Set-ItemProperty -LiteralPath "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ValidateAdminCodeSignatures" -Value 0 -Type DWord



BTW: with this section applied, the "Elevated Command Prompt" and "Elevated PowerShell" context menu entries become obsolete, because they both open elevated by default when UAC & LUA are fully disabled. ;)

Greetings and big thanks for this script. :)

Missing an argument NetFx3

v3.1.3.3:

Optimize-Offline.ps1 : Missing an argument for parameter 'NetFx3'. Specify a parameter of type 'Sys
tem.String' and try again.
+ CategoryInfo : InvalidArgument: (:) [Optimize-Offline.ps1], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingArgument,Optimize-Offline.ps1

Unsupported Image Version

After copy WIM image show in CMD:
WARNING: Unsupported Image Version: [0.0.7763]

Tested on v3.1.3.2, Win 1809 and LTSC both x64 any language.

Repaired code

Hi Ben. I fixed various things In your code in ps1 file only.
Modify script v3.1.3.0 is on: https://drive.google.com/drive/folders/1uNRRz1fgBIgbRU3DMydtyO5fzYWuQOsF

Fixed:

  • add elevated (cmd) open from drives
  • add corrected delimiters before and bottom Context menus elevated (cmd, PowerShell) items
  • GUI dialog titles removed dot after sentence (on "Out-GridView -Title" and "$Host.UI.RawUI.WindowTitle" lines)
  • correct date format for other world states and correct folder names
  • replacing text in script same text as variable $ScriptName
  • extension .Zip changed to .zip

Removed:

  • shortcuts icons optimalization (you version after restart changes all shorcuts icons to black box icons only, on Desktop and others locations)
  • pin Settings from Taskbar (if unpin then after reboot PC or restart Explorer.exe will Settings pinned on Taskbar be back)
  • Taskbar: Search Icon, Task View Icon

Failed creating a Bootable Windows Installation Media ISO.

Generating a Setup Post-Installation Script.
Cleaning-up the Image.
Post-Optimization Image Health State: [Healthy]
Saving and Dismounting the Image.
Rebuilding and Exporting the Image.
Optimizing the Windows Media File Structure.
Creating a Bootable Windows Installation Media ISO.

Failed creating a Bootable Windows Installation Media ISO.
Finalizing Optimizations.

Set-Content : An object at the specified path E:\make\x\Optimize-Offline_[11.29.18 10.00.17]\ErrorLog.log does not exist, or has been filtered by the -Include or -Exclude parameter.
At E:\make\x\Optimize-Offline.ps1:3225 char:9
+ Set-Content -Path $SaveErrorLog -Value $Error.ToArray() -Forc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (System.String[]:String[]) [Set-Content], Exception
+ FullyQualifiedErrorId : ItemNotFound,Microsoft.PowerShell.Commands.SetContentCommand

WARNING: Optimize-Offline completed in [35] minutes with [3] errors.

I'm using ".\Optimize-Offline.ps1 -ImagePath "E:\make\x\win.iso" -Index 6 -MetroApps "All" -SystemApps -Features" on a Windows 10 1803 system
.ISO file: en_windows_10_consumer_edition_version_1809_updated_sept_2018_x64_dvd_491ea967.iso

Tried several times without success

Errors after rebuild WIM

After finally rebuild WIM get this errors:

Post-Optimization Image Health State: [Healthy]
Saving and Dismounting the Image.
Rebuilding and Exporting the Image.
Finalizing Optimizations.
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\Optimize-Offline-master\Optimize-Offline.ps1:2524 char:37
+         $ErrorLog = Join-Path -Path $SaveDir -ChildPath ErrorLog.log
+                                     ~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCom
   mand

Add-Content : Cannot bind argument to parameter 'Path' because it is null.
At D:\Optimize-Offline-master\Optimize-Offline.ps1:2525 char:65
+ ... ach ($Process In $ProcessError) { Add-Content -Path $ErrorLog -Value  ...
+                                                         ~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Add-Content], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.AddContentC
   ommand

Add-Content : Cannot bind argument to parameter 'Path' because it is null.
At D:\Optimize-Offline-master\Optimize-Offline.ps1:2525 char:65
+ ... ach ($Process In $ProcessError) { Add-Content -Path $ErrorLog -Value  ...
+                                                         ~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Add-Content], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.AddContentC
   ommand

WARNING: Optimize-Offline completed in [49] minutes with [2] errors.
Press any key to continue . . .

I do not use ISO but WIM only.

Tested on v3.1.3.2 and v3.1.3.4

Could not find item messages in ErrorLog

Could not find item S:\Optimize-Offline-master\Optimize-Offline-master\OptimizeOfflineTemp_1627204548\MountOffline_1146830031\Windows\WinSxS\Backup\wow64_microsoft-windows-ui-xaml-inkcontrols_31bf3856ad364e35_10.0.17763.1_none_c9703603f13a2813_windows.ui.xaml.inkcontrols.dll_523c865d.

See attached ErrorLog and Optimize-Offline files. The path for all these files is in WinSxS\Backup folders, so probably not a real issue. No issues with installation.

This is using version 3.1.1.9. Perhaps an idea to include the version number in the error log.

Optimize-Offline.log
ErrorLog.log

Breaks 3rd party firewalls?

Not sure if it's intended, but 3rd party firewalls like TinyWall do not work correctly on Windows Installations modified with this script. I am not sure where exactly to post this, so I thought that I would post this here.

Suggestion: offer registry optimization selection

I really like what you're creating here! Finally a true LTSC version ;-)

One suggestion: could you possible make the registry optimizations selectable by using a pop-up window? (like with the features and packages selection). While 90% of the tweaks you apply are really useful, some of them are limiting my workflow a little too much.
For example disabling the "Show most used apps" in the Start Menu. This option is required for populating recently used applications when using StartIsBack++. The tweak you apply also renders the setting unusable (greyed out, managed by organization), so rolling back is not easy.

Missing all drivers

Dev. From version 3.1.3.2 after apply your script missing all based Drivers after install OS. (Grahics, Lan, Wan, etc.)
Manually add (from installed system) no allowed. Ended with error: E0000248

Tested on LTSC x64, command:
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -File .\Optimize-Offline.ps1 -ImagePath "%SourcePath%" -MetroApps "Select" -SystemApps -Packages -Features -Win32Calc -Registry
From UI selected for removing only:
Microsoft.BioEnrollment
Microsoft.Windows.SecHealthUI
Microsoft.XboxGameCallableUI

17134.1 Compatible?

Im on 1803 (17134) but script has other troubles???

INFO: Copying WIM from E:\Staging
Get-Item : Cannot find path 'C:\Users\Me\Documents\WindowsPowerShell\OptimizeOfflineTemp_726309043\ImageOffline_2084973981\install.wim' because it does not exist.
At C:\Users\Me\Documents\WindowsPowerShell\Optimize-Offline.ps1:462 char:23

  • ... $InstallWim = Get-Item -Path "$ImageFolder\install.wim" -Force
  •                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (C:\Users\adm0.n...981\install.wim:String) [Get-Item], ItemNotFoundException
    • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

Remove-Item : Cannot remove item C:\Windows\Logs\DISM\dism.log: The process cannot access the file 'C:\Windows\Logs\DISM\dism.log' because it is being used by another process.
At C:\Users\Me\Documents\WindowsPowerShell\Optimize-Offline.ps1:472 char:61

  • ... ism.log") { Remove-Item -Path "$Env:SystemRoot\Logs\DISM\dism.log" -F ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (C:\Windows\Logs\DISM\dism.log:FileInfo) [Remove-Item], IOException
    • FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand
      Get-WindowsImage : Cannot validate argument on parameter 'ImagePath'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command
      again.
      At C:\Users\Me\Documents\WindowsPowerShell\Optimize-Offline.ps1:476 char:34
  • If ((Get-WindowsImage -ImagePath $InstallWim -Index $Index).Installat ...
  •                              ~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Get-WindowsImage], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Dism.Commands.GetWindowsImageCommand

You cannot call a method on a null-valued expression.
At C:\Users\Me\Documents\WindowsPowerShell\Optimize-Offline.ps1:521 char:58

  • ... ng "The image version is not supported [$($CheckVersion.ToString())]"
  •                                           ~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

WARNING: The image version is not supported []

Too many closing curly brackets are causing errors in $DisableTelemetry

In v3.1.2.8 at line 2806 char 102 and at line 2807 char 128 there are unnecessary closing curly brackets.
Correct lines should be:
PowerShell -Command "& { Get-NetFirewallRule | Where-Object DisplayGroup -EQ 'Delivery Optimization' | Remove-NetFirewallRule -ErrorAction SilentlyContinue }"
and
PowerShell -Command "& { Get-NetFirewallRule | Where-Object DisplayGroup -Like 'Windows Media Player Network Sharing Service*' | Remove-NetFirewallRule -ErrorAction SilentlyContinue }"

Request: Optional packages for LTSC 2019

Since there is an option to integrate the Store and the Edge browser package, I would like to suggest that the following packages also be available:

Package Source Contents
Deduplication Server 2019 Microsoft-Windows-Dedup-ChunkLibrary-Package
Microsoft-Windows-Dedup-Package
Microsoft-Windows-FileServer-ServerCore-Package
Microsoft-Windows-VdsInterop-Package
Connect App Windows 10 1809 (Non-LTSC) PPIProjection ?

Error Logs With New Commit

Error logs:
Cannot find path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots' because it does not exist.
Cannot find path 'HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' because it does not exist.
I have ADK 1809 Deployment Tools installed.

Control Panel inactive item

In the Control Panel after removed SearchEngine-Client-Package is inactive (blank white icon, after click no any open) item "Indexing Options Control Panel (32 Bit)".

(tested on Win10 1809 64bit)

Maybe solution:
Adding DisallowCpl "Microsoft.IndexingOptions" if SearchEngine-Client-Package is queueing for Disabling

Getting Started?

Would be cool to have a brief "Getting Started" writeup in the Readme, just explaining how to go about optimizing a system. I know it doesn't work on a live system -- so what would be the procedure, for someone who isn't an experienced Windows admin? :)

Request: Grant-ProcessPrivilege GitHub page

I was wondering if you could share on GitHub the removed "Grant" region Helper Functions from Optimize-Offline 3.1.2.9.
Grant-ProcessPrivilege; Function Grant-FileAccess; Grant-FolderAccess are extremely useful and powerful.
A page with a brief explanation about them would help myself and others get the most benefit when applying them to our own scripts.

Iso With

Issue With 'Hide Extensions For File Types' Not Disabled.

If you don't disable this option in File Explorer then the extraction of the Windows ISO fails on start-up of the script.

If you could enable it by default with the script it would be helpful

Request: bypass registry optimisations

Hi,
I would like to use the script for everything other than the registry optimisations (although keeping getting rid of defaultuser0 and any other registry cleanups related to removing features/services). Something like a -NoRegistry switch? Leaving current registry switch out still produces all the altered registry changes (as noted by the log).

I prefer to use group policy scripts after the OS has installed.

Error With LTSC 2019.

Latest version when you try to run it on LTSC 2019 with '.\Optimize-Offline.ps1 -ImagePath "C:\en_windows_10_enterprise_ltsc_2019_x64_dvd_74865958.iso" -Build 17763 -SystemApps -Packages -Registry -NetFx3 $true' you get a message about an error on a registry entry in the script.

"D:\Optimize-Offline-master\Optimize-Offline-master\Optimize-Offline.ps1 : Missing an argument for parameter
'Registry'. Specify a parameter of type 'System.String' and try again.
+ CategoryInfo : InvalidArgument: (:) [Optimize-Offline.ps1], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : #MissingArgument,Optimize-Offline.ps1"

$Registry Try/Catch too broad

1.- Thanks for the script
2.- I am yet to manage a complete run of the script w/1709 multi-index image
3.- Removing '3D Print with 3D Builder' from the Context Menu. Fails and consequently falls through to the catch.

Recommendations:
1.- Create a function for manipulating the registry and have the try/catch in there so the whole script doesn't fail on a single error, or wrap each "remove-item" in a try/catch block.
2.- Display full error msg... this helps me debug; like I had "Secure Boot" on in my BIOS and it took me a while (30 mins) to figure why it was failing... DISM doesn't work w/ Secure Boot.

Love your work though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.