DrEmpiricism / Optimize-Offline

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] ArgumentOutOfRangeException

KedarWolf opened this issue · comments

Describe the bug
When running 4.0.0.9 I get the below error.

Index     : 0
Exception : Exception calling "Insert" with "2" argument(s): "Specified argument was out of the range of valid values.
            Parameter name: startIndex"
Category  : NotSpecified: (:) [], MethodInvocationException
ErrorID   : ArgumentOutOfRangeException
Target    : 
Command   : $WinpeshlString.Insert(77, '%SYSTEMDRIVE%\setup.exe') | Out-File -FilePath (GetPath -Path $BootMount 
            -Child 'Windows\System32\winpeshl.ini') -Force
Script    : D:\Optimize-Offline-4.0.0.9\Optimize-Offline-4.0.0.9\Optimize-Offline.psm1
Line      : 1180
Column    : 5

Screenshots
If applicable, add screenshots to help explain your problem.

Please complete the following information:

Windows 10 Enterprise

  • Image Build: 19041

  • Host Environment: Windows 10 Enterprise 1909

  • Parameters Passed:

"SourcePath": "D:\1\Win10_19041.207_x64_2020-04-21.iso",
"WindowsApps": "Select",
"SystemApps": true,
"Capabilities": true,
"Packages": true,
"Features": true,
"DeveloperMode": true,
"WindowsStore": false,
"MicrosoftEdge": false,
"Win32Calc": true,
"Dedup": false,
"DaRT": "Setup",
"Registry": true,
"Additional": {
"Setup": true,
"Wallpaper": false,
"SystemLogo": false,
"LockScreen": false,
"RegistryTemplates": true,
"LayoutModification": false,
"Unattend": true,
"Drivers": true,
"NetFx3": false
},
"ISO": "No-Prompt"

Log files


Running Module : Optimize-Offline 4.0.0.9
Optimize Start : 04/21/2020 07:27:15 AM
Identity Name : Kedar
Computer Name : DESKTOP-61EGET1


2020-04-21T07:27:15 [INFO]: Supported Image Build: [19041]
2020-04-21T07:27:18 [INFO]: Mounting Windows 10 Enterprise
2020-04-21T07:27:56 [INFO]: Mounting Microsoft Windows Setup (x64)
2020-04-21T07:28:04 [INFO]: Mounting Microsoft Windows Recovery Environment (x64)
2020-04-21T07:28:19 [INFO]: Pre-Optimization Image Health State: [Healthy]
2020-04-21T07:28:52 [INFO]: Removing Provisioned App Package: Microsoft.BingWeather
2020-04-21T07:28:55 [INFO]: Removing Provisioned App Package: Microsoft.GetHelp
2020-04-21T07:28:58 [INFO]: Removing Provisioned App Package: Microsoft.Getstarted
2020-04-21T07:29:01 [INFO]: Removing Provisioned App Package: Microsoft.Microsoft3DViewer
2020-04-21T07:29:04 [INFO]: Removing Provisioned App Package: Microsoft.MicrosoftOfficeHub
2020-04-21T07:29:07 [INFO]: Removing Provisioned App Package: Microsoft.MicrosoftSolitaireCollection
2020-04-21T07:29:10 [INFO]: Removing Provisioned App Package: Microsoft.MicrosoftStickyNotes
2020-04-21T07:29:13 [INFO]: Removing Provisioned App Package: Microsoft.MixedReality.Portal
2020-04-21T07:29:16 [INFO]: Removing Provisioned App Package: Microsoft.MSPaint
2020-04-21T07:29:19 [INFO]: Removing Provisioned App Package: Microsoft.Office.OneNote
2020-04-21T07:29:23 [INFO]: Removing Provisioned App Package: Microsoft.People
2020-04-21T07:29:26 [INFO]: Removing Provisioned App Package: Microsoft.ScreenSketch
2020-04-21T07:29:29 [INFO]: Removing Provisioned App Package: Microsoft.SkypeApp
2020-04-21T07:29:32 [INFO]: Removing Provisioned App Package: Microsoft.Wallet
2020-04-21T07:29:35 [INFO]: Removing Provisioned App Package: Microsoft.Windows.Photos
2020-04-21T07:29:38 [INFO]: Removing Provisioned App Package: Microsoft.WindowsAlarms
2020-04-21T07:29:41 [INFO]: Removing Provisioned App Package: Microsoft.WindowsCalculator
2020-04-21T07:29:44 [INFO]: Removing Provisioned App Package: Microsoft.WindowsCamera
2020-04-21T07:29:47 [INFO]: Removing Provisioned App Package: microsoft.windowscommunicationsapps
2020-04-21T07:29:50 [INFO]: Removing Provisioned App Package: Microsoft.WindowsFeedbackHub
2020-04-21T07:29:53 [INFO]: Removing Provisioned App Package: Microsoft.WindowsMaps
2020-04-21T07:29:56 [INFO]: Removing Provisioned App Package: Microsoft.WindowsSoundRecorder
2020-04-21T07:29:59 [INFO]: Removing Provisioned App Package: Microsoft.Xbox.TCUI
2020-04-21T07:30:02 [INFO]: Removing Provisioned App Package: Microsoft.XboxApp
2020-04-21T07:30:05 [INFO]: Removing Provisioned App Package: Microsoft.XboxGameOverlay
2020-04-21T07:30:08 [INFO]: Removing Provisioned App Package: Microsoft.XboxGamingOverlay
2020-04-21T07:30:11 [INFO]: Removing Provisioned App Package: Microsoft.XboxSpeechToTextOverlay
2020-04-21T07:30:14 [INFO]: Removing Provisioned App Package: Microsoft.YourPhone
2020-04-21T07:30:17 [INFO]: Removing Provisioned App Package: Microsoft.ZuneMusic
2020-04-21T07:30:21 [INFO]: Removing Provisioned App Package: Microsoft.ZuneVideo
2020-04-21T07:30:51 [INFO]: Removing System App: Microsoft.AAD.BrokerPlugin
2020-04-21T07:30:53 [INFO]: Removing System App: Microsoft.BioEnrollment
2020-04-21T07:30:55 [INFO]: Removing System App: Microsoft.ECApp
2020-04-21T07:30:57 [INFO]: Removing System App: Microsoft.LockApp
2020-04-21T07:30:59 [INFO]: Removing System App: Microsoft.MicrosoftEdge
2020-04-21T07:31:01 [INFO]: Removing System App: Microsoft.MicrosoftEdgeDevToolsClient
2020-04-21T07:31:03 [INFO]: Removing System App: Microsoft.Win32WebViewHost
2020-04-21T07:31:05 [INFO]: Removing System App: Microsoft.Windows.AddSuggestedFoldersToLibarayDialog
2020-04-21T07:31:07 [INFO]: Removing System App: Microsoft.Windows.CallingShellApp
2020-04-21T07:31:09 [INFO]: Removing System App: Microsoft.Windows.ContentDeliveryManager
2020-04-21T07:31:11 [INFO]: Removing System App: Microsoft.Windows.FileExplorer
2020-04-21T07:31:13 [INFO]: Removing System App: Microsoft.Windows.FilePicker
2020-04-21T07:31:15 [INFO]: Removing System App: Microsoft.Windows.ParentalControls
2020-04-21T07:31:17 [INFO]: Removing System App: Microsoft.Windows.PeopleExperienceHost
2020-04-21T07:31:19 [INFO]: Removing System App: Microsoft.Windows.SecHealthUI
2020-04-21T07:31:21 [INFO]: Removing System App: Microsoft.Windows.SecureAssessmentBrowser
2020-04-21T07:31:23 [INFO]: Removing System App: Windows.CBSPreview
2020-04-21T07:31:25 [INFO]: Disabling Services, Drivers and Integration Content for Removed Apps.
2020-04-21T07:31:30 [INFO]: Disabling Optional Feature: Windows-Defender-Default-Definitions
2020-04-21T07:31:38 [INFO]: Importing Custom App Associations.
2020-04-21T07:32:02 [INFO]: Removing Windows Capability: App.Support.QuickAssist
2020-04-21T07:32:07 [INFO]: Removing Windows Capability: Hello.Face.18967
2020-04-21T07:32:11 [INFO]: Removing Windows Capability: Hello.Face.Migration.18967
2020-04-21T07:32:16 [INFO]: Removing Windows Capability: OneCoreUAP.OneSync
2020-04-21T07:32:21 [INFO]: Removing Windows Capability: OpenSSH.Client
2020-04-21T07:32:26 [INFO]: Removing Windows Capability: MathRecognizer
2020-04-21T07:32:45 [INFO]: Removing Windows Package: Microsoft-Windows-LanguageFeatures-Speech-en-gb
2020-04-21T07:32:50 [INFO]: Removing Windows Package: Microsoft-Windows-LanguageFeatures-OCR-en-gb
2020-04-21T07:32:55 [INFO]: Removing Windows Package: Microsoft-Windows-LanguageFeatures-Handwriting-en-gb
2020-04-21T07:33:05 [INFO]: Disabling Optional Feature: MicrosoftWindowsPowerShellV2Root
2020-04-21T07:33:22 [INFO]: Disabling Optional Feature: Printing-XPSServices-Features
2020-04-21T07:33:26 [INFO]: Disabling Optional Feature: SmbDirect
2020-04-21T07:33:31 [INFO]: Disabling Optional Feature: WorkFolders-Client
2020-04-21T07:33:45 [INFO]: Enabling Optional Feature: Microsoft-Windows-Subsystem-Linux
2020-04-21T07:33:57 [INFO]: Integrating the Developer Mode Feature Package.
2020-04-21T07:34:08 [INFO]: Integrating the Win32 Calculator.
2020-04-21T07:34:10 [INFO]: Integrating Microsoft DaRT 10 and Windows 20H1 Debugging Tools into Microsoft Windows Setup (x64)
2020-04-21T07:34:16 [INFO]: Applying Optimized Registry Settings.
2020-04-21T07:34:23 [INFO]: Applying Setup Content.
2020-04-21T07:34:26 [INFO]: Importing Registry Template: Additional Tweaks.reg
2020-04-21T07:34:31 [INFO]: Applying Answer File.
2020-04-21T07:34:36 [INFO]: Injecting Driver Packages into Windows 10 Enterprise
2020-04-21T07:35:41 [INFO]: Injecting Driver Packages into Microsoft Windows Setup (x64)
2020-04-21T07:36:52 [INFO]: Injecting Driver Packages into Microsoft Windows Recovery Environment (x64)
2020-04-21T07:38:04 [INFO]: Cleaning-up the Start Menu Layout.
2020-04-21T07:38:07 [INFO]: Creating a Package Summary Log.
2020-04-21T07:38:24 [INFO]: Post-Optimization Image Health State: [Healthy]
2020-04-21T07:38:27 [INFO]: Saving and Dismounting Microsoft Windows Setup (x64)
2020-04-21T07:39:35 [INFO]: Rebuilding and Exporting Microsoft Windows Setup (x64)
2020-04-21T07:39:45 [INFO]: Saving and Dismounting Microsoft Windows Recovery Environment (x64)
2020-04-21T07:40:51 [INFO]: Rebuilding and Exporting Microsoft Windows Recovery Environment (x64)
2020-04-21T07:41:00 [INFO]: Saving and Dismounting Windows 10 Enterprise
2020-04-21T07:43:17 [INFO]: Rebuilding and Exporting Windows 10 Enterprise using Maximum compression.
2020-04-21T07:43:42 [INFO]: Optimizing the Installation Media File Structure.
2020-04-21T07:43:42 [INFO]: Creating a No-Prompt Bootable Windows Installation Media ISO.
2020-04-21T07:44:02 [INFO]: Finalizing Optimizations.
2020-04-21T07:44:02 [INFO]: Optimize-Offline completed in [16] minutes with [1] errors.


Optimizations Finalized : 04/21/2020 07:44:02 AM


OptimizeErrors.log

commented

The only way this would throw an error is if the encoding for the module itself was not UTF-8 (which is the standard encoding for all PowerShell projects). Different types of encoding can alter Here-String values by adding byte characters to them that you cannot see within the code itself but would increase the integer count of the string's length.

Have you opened the module and then saved it in something like Notepad (which would change its encoding)?

I'm sure I only edited the Offline-Resources.psm1 in PowerShell ISE.

I tried editing it in Notepad++ and saving it with the UTF-8-BOM encoding it opens with, same error.

And I tried editing the configuration.json with Notepad++ as well.

I have the same issue, even if I edit file in PowerShell ISE or Notepad++ using the UTF 8 BOM encoding it opens with the same error. The only way to get rid of above error (for me) is edit Configuration.json and remove DaRT integration. After this, error doesn't come back.

commented

This was fixed in the latest update.