Dism can't add them at that point because the image is being serviced by another application. You can see the error if you put a "pause" command at the end of the BuildScript so it keeps the command prompt window on screen until you press a key.
There are a couple ways around the problem:
1) Using Dism, you can manually mount the WIM you'll be using (located in the appropriate ADK install path), add the packages to it, then unmount it. Once they're added they don't need to be added again since the WIM would remain with them included. Then just create the TBWinPE build normally.
2) I don't think this method is currently documented, but you can add the packages you want to include to the "WinPEPackages.txt" file in the build's folder ("S:\TBWinPE\WinPEPackages.txt" in your case). List one package per line in the order to install (some have dependencies that must be installed first). A line beginning with a ; will be ignored as a comment. You only need to specify the package name ("WinPE-HTA", for example), but can include the .cab extension if wanted ("WinPE-HTA.cab"). The language file for the package will be included automatically so don't specify it. Also, if you're using the TBWinPE option to add BitLocker support (Build Options tab in Settings), the following packages are already being installed prior to any listed in the WinPEPackages.txt file: WinPE-WMI, WinPE-SecureStartup, WinPE-EnhancedStorage. The build log will show if the packages installed successfully or if there were any errors.
TeraByte Support(PP) wrote: ↑Fri Dec 02, 2022 9:56 pm
I don't think this method is currently documented
Frankly I think it should. Once you install WinPE-HTA.cab, it is able to give support to run certain applications like for example: DiskGenius.
Who knows what other apps might be able to run once this package is added.
Btw I ditched my own WinPE project in favor of your TBWinPE. I love it, it's just great.
I'm going to try this second method asap and will come back to add some feedback.