I've Googled all over the place on how to remove the built in Windows 10 Apps like 3D Builder, Zune, Xbox, etc from a Windows 10 image file.
All of the tutorials always point to the same thing - Remove-AppxProvisionedPackage
- which is what I'm trying to do.
Whenever I try to remove the package, I always get a The System cannot find the file specified
error.
This is the output I'm getting from mounting the image until I try to remove the package.
Trying to remove individual packages or the whole shebang gives me the same result.
PS C:\wds> Mount-WindowsImage -ImagePath .\2016-Test-Export.wim -Path .\mnt -Index 1
Path : .\mnt
Online : False
RestartNeeded : False
PS C:\wds> Get-AppxProvisionedPackage -Path .\mnt
DisplayName : Microsoft.3DBuilder
Version : 11.1.9.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.3DBuilder_11.1.9.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.BingWeather
Version : 4.16.15.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.BingWeather_4.16.15.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.DesktopAppInstaller
Version : 1.8.5001.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.DesktopAppInstaller_1.8.5001.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.Getstarted
Version : 4.1.15.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.Getstarted_4.1.15.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.Messaging
Version : 2.7.1001.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.Messaging_2.7.1001.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.MicrosoftOfficeHub
Version : 2015.7420.23751.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.MicrosoftOfficeHub_2015.7420.23751.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.MicrosoftSolitaireCollection
Version : 3.12.10310.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.MicrosoftSolitaireCollection_3.12.10310.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.MicrosoftStickyNotes
Version : 1.1.41.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.MicrosoftStickyNotes_1.1.41.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.Office.OneNote
Version : 2015.7466.57771.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.Office.OneNote_2015.7466.57771.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.OneConnect
Version : 1.1607.6.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.OneConnect_1.1607.6.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.People
Version : 2016.1011.2336.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.People_2016.1011.2336.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.SkypeApp
Version : 11.9.251.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.SkypeApp_11.9.251.0_neutral_~_kzf8qxf38zg5c
DisplayName : Microsoft.StorePurchaseApp
Version : 11608.1000.24314.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.StorePurchaseApp_11608.1000.24314.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.Windows.Photos
Version : 2016.722.10060.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.Windows.Photos_2016.722.10060.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.WindowsAlarms
Version : 2016.1010.1800.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.WindowsAlarms_2016.1010.1800.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.WindowsCalculator
Version : 2016.809.14.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.WindowsCalculator_2016.809.14.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.WindowsCamera
Version : 2016.816.20.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.WindowsCamera_2016.816.20.0_neutral_~_8wekyb3d8bbwe
DisplayName : microsoft.windowscommunicationsapps
Version : 2015.7369.40827.0
Architecture : neutral
ResourceId : ~
PackageName : microsoft.windowscommunicationsapps_2015.7369.40827.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.WindowsFeedbackHub
Version : 1.1608.2441.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.WindowsFeedbackHub_1.1608.2441.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.WindowsMaps
Version : 2016.921.2109.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.WindowsMaps_2016.921.2109.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.WindowsSoundRecorder
Version : 2016.808.1111.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.WindowsSoundRecorder_2016.808.1111.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.WindowsStore
Version : 11610.1001.104.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.WindowsStore_11610.1001.104.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.XboxApp
Version : 2016.1006.321.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.XboxApp_2016.1006.321.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.XboxIdentityProvider
Version : 2016.719.1035.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.XboxIdentityProvider_2016.719.1035.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.ZuneMusic
Version : 2019.16092.10311.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.ZuneMusic_2019.16092.10311.0_neutral_~_8wekyb3d8bbwe
DisplayName : Microsoft.ZuneVideo
Version : 2019.16092.10311.0
Architecture : neutral
ResourceId : ~
PackageName : Microsoft.ZuneVideo_2019.16092.10311.0_neutral_~_8wekyb3d8bbwe
PS C:\wds> Get-AppxProvisionedPackage -Path .\mnt | Remove-AppxProvisionedPackage -Path .\mnt
Remove-AppxProvisionedPackage : The system cannot find the file specified.
At line:1 char:42
+ ... sionedPackage -Path .\mnt | Remove-AppxProvisionedPackage -Path .\mnt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Remove-AppxProvisionedPackage], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.RemoveAppxProvisionedPackageCommand
I must be missing something but just can't work out what I'm missing.
I've also tried doing the same thing with DISM and run into the same error, system cannot find the specified file
.
The Get-AppxProvisionedPackage finds the packages, so they exist... Any ideas on how to remove these?
Edit: Using the syntax suggested by Slipeer:
PS C:\wds> Get-AppxProvisionedPackage -Path .\mnt | foreach{ Remove-AppxProvisionedPackage -path .\mnt -PackageName $_.PackageName }
Remove-AppxProvisionedPackage : The system cannot find the file specified.
At line:1 char:51
+ ... | foreach{ Remove-AppxProvisionedPackage -path .\mnt -PackageName $_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Remove-AppxProvisionedPackage], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.RemoveAppxProvisionedPackageCommand
<Repeated for all the packages>
Edit: I've also tried this script - https://gallery.technet.microsoft.com/Removing-Built-in-apps-65dc387b - also the same result.
As I understand it cmdlet Remove-AppxProvisionedPackage works differently: the package name must be passed in parameter
-PackageName
Try:
Get-AppxProvisionedPackage -Path .\mnt | foreach {Remove-AppxProvisionedPackage -Path .\mnt -PackageName $_.PackageName }
But it makes no sense to do it in an offline image. Removed component is restored when you install an update that contains fixes for it. Updates are released every month.
It is better to implement the cleaning of unnecessary components on a regular basis (such as through the Task Scheduler).
I ran into the exact same problem. Running the native dism version of the command got me error messages in the dism log about "failed to get staged packages for package". And googling that led me to this page on edugeek.
So the user there noticed that if he went back to the original 1607 ISO, the commands worked fine. Likewise, I tried the same commands with the 1703 ISO I had, and everything works. So it appears something is up with some of the WIM files Microsoft is distributing. (The one that was problematic for me was 1607 updated Jan 2017, straight from my MSDN subscription.)
For now I plan to just use the original release media to get these provisioned apps uninstalled. Also, things may be improving more with respect to the provisioned apps coming back. Microsoft announced that starting in 1703, de-provisioned apps will stay de-provisioned after future feature update installations...
It doesn't help matters that Microsoft has (perhaps unintentionally) made it hard to get the original release media for some Windows 10 versions, even with an MSDN subscription. One way to get some of the original release media is outlined here
My first advice is to avoid PowerShell and rather dism.
Dism /Mount-Wim /Wimfile:C:\IsoW10\sources\install.wim /Index:1 /MountDir:C:\IsoWindows
Dism /Image:C:\IsoWindows /Get-ProvisionedAppxPackages >> C:\ProvisionedAppxPackagesW10.txt
Dism /Image:C:\IsoWindows /Remove-Provisionedappxpackage /PackageName:Microsoft.3DBuilder_13.0.10349.0_neutral_~_8wekyb3d8bbwe
Dism /Unmount-Wim /MountDir:C:\IsoWindows /commit
PS : About the file install.wim. As you can guess, yes you will find it in the folder sources. I had also create this pastebin which provide one good resume and a few more details. On the moment, I had forgot but the dism solution isn't perfect... Because it will remove almost everything (but no the last one such as : Microsoft.Windows.Apprep.ChxApp, Microsoft.Windows.ParentalControls, etc). If you want to check it, run one command (PowerShell) like :
Get-AppxPackage | Select Name, PackageFullName
. The website serverfault.com doesn't allow me to add another link...