Skip to content

Fix: Prevent mount conflicts and improve script stability with isolated scratch directories#623

Open
ducsum wants to merge 2 commits into
ntdevlabs:mainfrom
ducsum:main
Open

Fix: Prevent mount conflicts and improve script stability with isolated scratch directories#623
ducsum wants to merge 2 commits into
ntdevlabs:mainfrom
ducsum:main

Conversation

@ducsum

@ducsum ducsum commented Jul 16, 2026

Copy link
Copy Markdown

Description

This PR improves the stability and fault tolerance of tiny11maker.ps1, specifically fixing "Access Denied" and DISM mount conflicts during the build process.

Fixes & Improvements:

  • Isolated Mount Points: Separated $ScratchDisk\scratchdir into scratchdir_install and scratchdir_boot. This prevents fatal "Directory is not empty" errors if install.wim unmount leaves lingering file locks behind.
  • Robust Cleanup: Replaced standard Remove-Item with a custom Remove-ItemWithRetry function (retries with a delay and falls back to cmd rmdir). This stops the script from crashing during final cleanup due to Windows Defender locking files.
  • Auto Cleanup: Added dism /Cleanup-Mountpoints at startup to clear orphaned mounts from previous failed runs.
  • Cached XML: Stopped deleting autounattend.xml at the end so users don't have to re-download it on every run.
  • README Update: Fixed the -SCRATCH param documentation to indicate it accepts a <path> instead of just a <letter>.

Note: Since tiny11Coremaker.ps1 shares the same logic, I highly recommend applying these isolated mount points and retry-cleanup changes there as well to prevent the same crashes.

ducsum added 2 commits July 16, 2026 13:38
Added Remove-ItemWithRetry to prevent infinite loops, separated scratchdir for install/boot WIMs to prevent mount errors, and added Cleanup-Mountpoints.
Updated the script path instructions in the README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant