[/QUOTE] I'm pretty sure you need to manually run Set-Additional.cmd after you install Windows. The Setup option I believe just runs the SetupComplete.cmd and only applies the below. 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" DEL /F /Q "%WINDIR%\Setup\Scripts\Refresh-Explorer.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"
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" DEL /F /Q "%WINDIR%\Setup\Scripts\Refresh-Explorer.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" oops.. completely forgot that my SetupComplete.cmd was already edited to include (amongst other things) Code: call “%WinDir%\ Setup \ Scripts \ Set-Additional.cmd”
Seems error 0x8007000e refers to lack of memory or disk space Might try and run the script on a larger hdd and see if it still happens. Will try and run Set-Additional.cmd once Windows has finished installation. How can I amend the SetupComplete.cmd to include both ScheduledTasks & Services.json to be run when Setup: True is selected under configuration.json?
I highly recommend *not* blindly running "Set-Additional.cmd" There are many posts on this thread from people who break their perfectly good OS after applying Set-Additional.cmd and can't understand why. There are many posts on the GitHub issues page where people have pointed out problems with that script and it just never gets fixed. The developer uses a "get-out-of-jail" pass by telling people that you have to understand what the script is doing and don't come weeping to him when stuff breaks. What this means is that the only way to use that script is to go through it line-by-line and research what it's doing. The optimize-offline project is very special. The Set-Additional.cmd is *not* at all special!! There is nothing that the Set-Additional.cmd script does that other Tasks/Services/Firewall tweaking scripts can't do. It's much easier to find a tweaking script written in command-line code rather than PowerShell. There are many good choices and they are much easier to edit to make them do what you want or reverse if something gets broken. That's my opinion....
Thanks Have just been going through the different options under Set-Additional.ps1 and maybe this is not something I want to run!
Is there a way to amend the SetupComplete.cmd to include both ScheduledTasks & Services.json to be run when Setup: True is selected under configuration.json?
You could try something like this, save as Set Services Scheduled Tasks to Start DISABLED.cmd in setup directory Code: @rem *** Set Services Start = DISABLED *** sc stop DiagTrack sc stop diagnosticshub.standardcollector.service sc stop dmwappushservice sc stop RemoteRegistry sc stop TrkWks sc stop WMPNetworkSvc sc stop SysMain sc stop lmhosts sc stop VSS sc stop RemoteAccess sc stop WSearch sc stop iphlpsvc sc stop DoSvc sc stop ICEsoundService sc stop ClickToRunSvc sc stop SEMgrSvc sc stop RtkAudioUniversalService sc stop BDESVC sc stop TabletInputService sc stop SstpSvc sc stop NvTelemetryContainer sc stop HomeGroupListener sc stop HomeGroupProvider sc stop lfsvc sc stop MapsBroke sc stop NetTcpPortSharing sc stop SharedAccess sc stop WbioSrv sc stop WMPNetworkSvc sc config DiagTrack start= disabled sc config diagnosticshub.standardcollector.service start= disabled sc config dmwappushservice start= disabled sc config RemoteRegistry start= disabled sc config TrkWks start= disabled sc config WMPNetworkSvc start= disabled sc config SysMain start= disabled sc config lmhosts start= disabled sc config VSS start= disabled sc config RemoteAccess start= disabled sc config WSearch start= disabled sc config iphlpsvc start= disabled sc config DoSvc start= disabled sc config ICEsoundService start= disabled sc config ClickToRunSvc start= demand sc config SEMgrSvc start= disabled sc config RtkAudioUniversalService start= disabled sc config BDESVC start= disabled sc config TabletInputService start= disabled sc config SstpSvc start= disabled sc config NvTelemetryContainer start= disabled sc config HomeGroupListener start= disabled sc config HomeGroupProvider start= disabled sc config lfsvc start= disabled sc config MapsBroke start= disabled sc config NetTcpPortSharing start= disabled sc config SharedAccess start= disabled sc config WbioSrv start= disabled sc config WMPNetworkSvc start= disabled REM *** Set Scheduled Tasks = DISABLED *** schtasks /Change /TN "Microsoft\Windows\AppID\SmartScreenSpecific" /Disable schtasks /Change /TN "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /Disable schtasks /Change /TN "Microsoft\Windows\Application Experience\ProgramDataUpdater" /Disable schtasks /Change /TN "Microsoft\Windows\Application Experience\StartupAppTask" /Disable schtasks /Change /TN "Microsoft\Windows\Autochk\Proxy" /Disable schtasks /Change /TN "Microsoft\Windows\Customer Experience Improvement Program\Consolidator" /Disable schtasks /Change /TN "Microsoft\Windows\Customer Experience Improvement Program\KernelCeipTask" /Disable schtasks /Change /TN "Microsoft\Windows\Customer Experience Improvement Program\UsbCeip" /Disable schtasks /Change /TN "Microsoft\Windows\Customer Experience Improvement Program\Uploader" /Disable schtasks /Change /TN "Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector" /Disable schtasks /Change /TN "Microsoft\Windows\Maintenance\WinSAT" /Disable schtasks /Change /TN "Microsoft\Windows\Shell\FamilySafetyUpload" /Disable schtasks /Change /TN "Microsoft\Windows\SystemRestore\SR" /Disable schtasks /Change /TN "Microsoft\Office\OfficeTelemetryAgentLogOn" /Disable schtasks /Change /TN "Microsoft\Office\OfficeTelemetryAgentFallBack" /Disable schtasks /Change /TN "Microsoft\Office\Office 15 Subscription Heartbeat" /Disable schtasks /Change /TN "\Microsoft\Windows\Power Efficiency Diagnostics\AnalyzeSystem" /Disable REM schtasks /Change /TN "Microsoft\Windows\Autochk\Proxy" /Disable REM schtasks /Change /TN "Microsoft\Windows\CloudExperienceHost\CreateObjectTask" /Disable REM schtasks /Change /TN "Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector" /Disable REM schtasks /Change /TN "Microsoft\Windows\DiskFootprint\Diagnostics" /Disable *** Not sure if should be disabled, maybe related to S.M.A.R.T. REM schtasks /Change /TN "Microsoft\Windows\FileHistory\File History (maintenance mode)" /Disable REM schtasks /Change /TN "Microsoft\Windows\Maintenance\WinSAT" /Disable REM schtasks /Change /TN "Microsoft\Windows\NetTrace\GatherNetworkInfo" /Disable REM schtasks /Change /TN "Microsoft\Windows\PI\Sqm-Tasks" /Disable REM schtasks /Change /TN "Microsoft\Windows\Time Synchronization\ForceSynchronizeTime" /Disable REM schtasks /Change /TN "Microsoft\Windows\Time Synchronization\SynchronizeTime" /Disable REM schtasks /Change /TN "Microsoft\Windows\Windows Error Reporting\QueueReporting" /Disable REM schtasks /Change /TN "Microsoft\Windows\WindowsUpdate\Automatic App Update" /Disable and call it by adding this line to setupcomplete.cmd (found in the same directory), Code: call “%WinDir%\ Setup \ Scripts \ Set Services Scheduled Tasks to Start DISABLED.cmd” ... obviously edit script to suit your own needs as pulled it off some notes I made some time ago. The format is merely what I am trying to convey.
@drew84 's way is great! Here is a way to handle services. Add "OOBE.cmd" to the "\Additional\Setup" folder along with SetupComplete.cmd OOBE.cmd is natively called by Windows Setup the same as SetupComplete.cmd As an aside, it's considered "best practice" to clear out your added scripts so for the one shared by @drew84 and my suggested OOBE.cmd you should add the following two lines of code to the *end* of SetupComplete.cmd Code: DEL /F /Q "%WINDIR%\Setup\Scripts\Start DISABLED.cmd" >NUL 2>&1 DEL /F /Q "%WINDIR%\Setup\Scripts\OOBE.cmd" >NUL 2>&1 OOBE.cmd Code: REM Disable unwanted services that run on a fresh install (plus NcaSvc that depends on iphlpsvc) for /d %%G in ( WSearch, CDPSvc, DiagTrack, DsSvc, DusmSvc, iphlpsvc, NcaSvc, SgrmBroker, SmsRouter, SSDPSRV, SysMain, TabletInputService ) do ( sc config %%G start= disabled ) The same @drew84 note applies "... obviously edit script to suit your own needs ... The format is merely what I am trying to convey."
So just trying to understand how the setup:true works (under configuration.json) This runs setup.cmd once Windows has finished installing. Without any editing to the setup.cmd, this will only run refresh-explorer and unattended xml? If I didn’t make any adjustments to the original setup.cmd and did not have an unattended file then changing setup:false in the configuration would be ok? I think in gdeliana’s fork it is set as true?
there is an explanation file contained within the folder... any .cmd file will be executed during installation... for example: if you don't want to run Set-Additional.ps1 then delete Set-Additional.cmd by the same method.. if you find powershell scripts online that you want to run, just place them in the same folder... and create a .cmd file to call(run) them... using the Set-Additional.cmd as a template ... for example - found .ps1 script (Tell Windows to **** off.ps1) .cmd file would be called Tell Windows to **** off.cmd... and would look like this: Code: @ECHO OFF CD /D "%~dp0" NET SESSION >NUL 2>&1 IF %ERRORLEVEL% NEQ 0 ( ECHO Permission denied. This script must be run as an Administrator. ECHO: PAUSE EXIT ) ELSE ( PowerShell.exe -NoProfile -ExecutionPolicy Bypass -File .\Set-Tell Windows to **** off.ps1 -Argument 2> .\Set-Tell Windows to **** off.error DEL /F /Q "%~dp0Set-Tell Windows to **** off.error" >NUL 2>&1 DEL /F /Q "%~dp0Set-Tell Windows to **** off.ps1" >NUL 2>&1 DEL /F /Q "%~f0" >NUL 2>&1 ) PAUSE EXIT ... pretty sure this is correct, but if I am wrong... you get the gist
... forgot to mentiom THE most important point.... @gdeliana's fork is designed to push the boundries of what is currently available with original script... so using it... assumes you actually know (or at least have an idea of) what you are doing (in otherwords .. if something goes wrong it is your (your-your-your... etc) fault/problem
Wow! thanks for sharing that. I should have said "drew84's proposed solution" or at least that was what I meant when I called it "your method".
Just did a run of OO (gdeliana's fork) and everything went well with no errors. The issue I had previously (error code 0x8007000e) has not returned as I loaded OO on a different ssd with more free space. I am using this to slim down LTSC 1809 (updated with W10UI to latest updates). Are there any other Services/Features etc I should disable/remove? Have included the log below Code: *************************************************************************************************** Running Module : Optimize-Offline 4.0.1.7 Optimize Start : 09/02/2021 03:46:56 PM Identity Name : SirSSV Computer Name : LAPTOP *************************************************************************************************** 2021-09-02T15:46:56 [INFO]: Supported Image Build: [17763] 2021-09-02T15:46:59 [INFO]: Mounting Windows 10 Enterprise LTSC 2021-09-02T15:49:21 [INFO]: Pre-Optimization Image Health State: [Healthy] 2021-09-02T16:03:27 [INFO]: Removing System App: InputApp 2021-09-02T16:03:29 [INFO]: Removing System App: Microsoft.AAD.BrokerPlugin 2021-09-02T16:03:31 [INFO]: Removing System App: Microsoft.BioEnrollment 2021-09-02T16:03:33 [INFO]: Removing System App: Microsoft.ECApp 2021-09-02T16:03:35 [INFO]: Removing System App: Microsoft.LockApp 2021-09-02T16:03:37 [INFO]: Removing System App: Microsoft.MicrosoftEdgeDevToolsClient 2021-09-02T16:03:40 [INFO]: Removing System App: Microsoft.Win32WebViewHost 2021-09-02T16:03:42 [INFO]: Removing System App: Microsoft.Windows.AddSuggestedFoldersToLibarayDialog 2021-09-02T16:03:44 [INFO]: Removing System App: Microsoft.Windows.Cortana 2021-09-02T16:03:46 [INFO]: Removing System App: Microsoft.Windows.FileExplorer 2021-09-02T16:03:48 [INFO]: Removing System App: Microsoft.Windows.FilePicker 2021-09-02T16:03:50 [INFO]: Removing System App: Microsoft.Windows.ParentalControls 2021-09-02T16:03:52 [INFO]: Removing System App: Microsoft.Windows.PeopleExperienceHost 2021-09-02T16:03:54 [INFO]: Removing System App: Microsoft.Windows.SecHealthUI 2021-09-02T16:03:56 [INFO]: Removing System App: Microsoft.XboxGameCallableUI 2021-09-02T16:03:58 [INFO]: Removing System App: Windows.CBSPreview 2021-09-02T16:04:01 [INFO]: Disabling Services, Drivers and Integration Content for Removed Apps. 2021-09-02T16:04:08 [INFO]: Removing Windows Biometric Capability Packages. 2021-09-02T16:04:29 [INFO]: Disabling Optional Feature: Windows-Defender-Default-Definitions 2021-09-02T16:04:35 [INFO]: Importing Custom App Associations. 2021-09-02T16:07:24 [INFO]: Removing Windows Capability: App.Support.QuickAssist 2021-09-02T16:07:29 [INFO]: Removing Windows Capability: Language.Handwriting 2021-09-02T16:07:34 [INFO]: Removing Windows Capability: Language.OCR 2021-09-02T16:07:39 [INFO]: Removing Windows Capability: Language.Speech 2021-09-02T16:07:45 [INFO]: Removing Windows Capability: MathRecognizer 2021-09-02T16:07:50 [INFO]: Removing Windows Capability: OneCoreUAP.OneSync 2021-09-02T16:07:57 [INFO]: Removing Windows Capability: OpenSSH.Client 2021-09-02T16:09:07 [INFO]: Disabling Optional Feature: MicrosoftWindowsPowerShellV2Root 2021-09-02T16:11:04 [INFO]: Disabling Optional Feature: FaxServicesClientPackage 2021-09-02T16:11:10 [INFO]: Disabling Optional Feature: MSRDC-Infrastructure 2021-09-02T16:11:15 [INFO]: Disabling Optional Feature: Printing-XPSServices-Features 2021-09-02T16:11:20 [INFO]: Disabling Optional Feature: SmbDirect 2021-09-02T16:11:26 [INFO]: Disabling Optional Feature: WorkFolders-Client 2021-09-02T16:11:50 [INFO]: Enabling Optional Feature: DirectPlay 2021-09-02T16:11:56 [INFO]: Enabling Optional Feature: LegacyComponents 2021-09-02T16:12:01 [INFO]: Applying Optimized Registry Settings. 2021-09-02T16:12:13 [INFO]: Applying Setup Content. 2021-09-02T16:12:17 [INFO]: Importing Registry Template: Additional Tweaks.reg 2021-09-02T16:12:23 [INFO]: Cannot perform a clean-up of the Component Store while there are pending installations. 2021-09-02T16:12:23 [INFO]: Cleaning-up the Start Menu Layout. 2021-09-02T16:12:27 [INFO]: Disabling Windows Update 2021-09-02T16:12:28 [INFO]: Disabling automatic driver update 2021-09-02T16:12:29 [INFO]: Enabling dormant OneDrive fix 2021-09-02T16:12:35 [INFO]: Post-Optimization Image Health State: [Healthy] 2021-09-02T16:12:39 [INFO]: Saving and Dismounting Windows 10 Enterprise LTSC 2021-09-02T16:15:28 [INFO]: Rebuilding and Exporting Windows 10 Enterprise LTSC using Maximum compression. 2021-09-02T16:16:01 [INFO]: Optimizing the Installation Media File Structure. 2021-09-02T16:16:01 [INFO]: Creating a No-Prompt Bootable Windows Installation Media ISO. 2021-09-02T16:16:09 [INFO]: Finalizing Optimizations. 2021-09-02T16:16:09 [INFO]: Optimize-Offline completed in [29] minutes with [0] errors. *************************************************************************************************** Optimizations Finalized : 09/02/2021 04:16:09 PM *************************************************************************************************** Not sure why there OO cannot perform a clean-up of the component store. Could it be because LTSC does not include Windows Store?
(AFAIK) If you want to search for apps in the native start menu, then you want to keep the System App of Microsoft.Windows.Cortana Cortana system app is not the same as the Windows store app. All it does is search. If you keep it, it shows in the "App history" in task manager but it it's using 0 resources. "Cortana" as search only uses resources when you search for built-in or installed apps in the start menu. When you're done searching, Cortana (search) surrenders the memory back to the system. (AFAIK) It's been a long time since I optimized build 17763 so I don't think there is anything else you can remove. These are all safe to remove, but I think they start to show up in builds later than LTSC 1809: Microsoft.Windows.AppRep.ChxApp Microsoft.Windows.AppResolverUX Microsoft.Windows.AssignedAccessLockApp Microsoft.Windows.CapturePicker Microsoft.Windows.ContentDeliveryManager Microsoft.Windows.PinningConfirmationDialog Microsoft.Windows.SecureAssessmentBrowser Microsoft.Windows.XGpuEjectDialog What are you using?. A Celeron with a 2005 era 40GB hard disk?
"Cannot perform a clean-up of the Component Store while there are pending installations." You can safely ignore this. Why (I think) this happens. Optimize Offline correctly bypasses cleaning the Component Store when there are pending updates. In the mounted image, Optimize-Offline.psm1 checks for pending updates by looking for "pending.xml" in "Windows\WinSxS." See Line # 2015 If (!(Test-Path -Path (GetPath -Path $InstallMount -Child 'Windows\WinSxS\pending.xml'))) There may be other reasons, but enabling .NET 3.5. in W10UI seems to be the "problem." If I apply updates to the image using W10UI then Optimize Offline cleans the Component Store. If, in addition to applying updates, I also use W10UI to enable .NET 3.5, then Optimize Offline aborts Component Store clean-up. The W10UI script handles updates and enabling .NET 3.5 perfectly so there isn't an actual problem, but the pending.xml must have final business to perform during install. If you're feeling inspired... Since you seem to have ~29 minutes to kill while your script runs... After OO mounts your image, you can safely open the temporary mount folder and open in notepad 'Windows\WinSxS\pending.xml" and report back here with what it says. Just make sure you close notepad and close any open explorer window before the script finishes or you may have a left-over temporary mount folder that you need to get rid of. If that happens just close all explorer windows and run in an Admin command prompt: Code: dism /cleanup-wim or if you've mounted an ISO Code: dism /Cleanup-Mountpoints