Updated Remove Apps Script, and a Workaround
I’ve updated the script attached to http://blogs.technet.com/b/mniehaus/archive/2015/11/11/removing-windows-10-in-box-apps-during-a-task-sequence.aspx to address a couple of issues:
- Fixed a bug that prevented the script from working properly offline when no RemoveApp.xml file was present (requiring the script to dynamically generate the list offline). Thanks to Osama Altawil for reporting that issue a few weeks ago.
- Modified the logic that located the RemoveApps.xml file. It now loads the file from the current PowerShell working directory.
I also updated the blog and script comments to indicate that the Storage Management Cmdlets are also required.
One other issue that has been reported by a variety of people: When running the script offline in Windows PE 1511 as part of an MDT Lite Touch task sequence, the script is unable to load the DISM PowerShell module, and as a result the script fails. We did figure out how to reproduce the problem with a generic Windows PE boot image:
- Load a web page or HTA using MSHTA.EXE, then close MSHTA.EXE.
- Run PowerShell.exe, try to “Import-Module DISM”.
The module import command fails with error 0x80131515. We’re still investigating exactly what’s going on with that, but in the meantime, there is a simple workaround, described at http://stackoverflow.com/questions/19957161/add-type-load-assembly-from-network-unc-share-error-0x80131515 for a similar problem. (For whatever reason, after running MSHTA.EXE, PowerShell thinks that the DISM module isn’t local.) Just add a step to your task sequence that copies a file named powershell.exe.config into X:\Windows\System32\WindowsPowerShell\v1.0 folder (or embed it in your boot image), with the following content:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <loadFromRemoteSources enabled="true"/> </runtime> </configuration>
If you do that prior to the step that runs RemoveApps.ps1, then the DISM module will load fine and the script will work. (With any luck, there will be a permanent solution in a future ADK release.)