Removing Windows 10 in-box apps during a task sequence
A couple of years ago, Ben Hunter posted a script on the Deployment Guys blog that showed how to remove the in-box modern apps from a Windows 8.1 installation. That exact same approach works with Windows 10 as well. But there’s more that can be done, especially since the list of apps is different for Windows 8.1 and Windows 10 (and potentially changes with each Windows 10 feature upgrade), and since apps can be removed offline as well as online.
Attached to this blog (below) is the next generation of that script, designed to dynamically determine the list of apps if you don’t specify a list yourself. It’s designed to run inside a task sequence (although it could be run manually if needed), either while in Windows PE to remove apps offline, or in the new OS to remove apps online.
Why would you want to remove apps offline? A couple of reasons:
- It’s faster. By removing the apps offline, the provisioned apps won’t install when the OS boots up for the first time, so the first logon is faster and there’s no need to remove the installed apps either.
- It avoids potential issues with the installation of provisioned apps. All apps provisioned in the image install asynchronously on Windows 10 with the first logon. So it’s possible that the task sequence starts removing apps while they are still being installed. As a result, a script may fail to remove the app because it’s not there yet, and removing the provisioned app may not prevent the pending install from completing. It’s a timing issue – your results may vary based on what happens in your specific task sequence.
- It avoids potential issues with Windows Update. Sometimes while building an image, the Windows Update agent can update the apps while you’re trying to remove them. That can cause the removal to not work, and later if you try to sysprep and capture the image, that can fail. (This is not a problem if you build your image on an isolated network with no internet access.)
Let’s talk about pre-requisites. First, you need to use PowerShell to do this. Online (within the running OS) that’s no big deal, since Windows 8.1 and Windows 10 include PowerShell by default. But with Windows PE, it’s an optional component that needs to be added. In addition to PowerShell, make sure you add the .NET Framework, the DISM Cmdlets, and the Storage Management Cmdlets components, as the script uses all of those.
Note that there can be some challenges with the original Windows 10 ADK when adding .NET and PowerShell to the boot image. Those issues should be fixed in the November 2015 version of the ADK. (We think that a separate problem with PowerShell failing in Windows PE with an exception at startup is also fixed in the new ADK, but you’ll need to verify that, we’re still trying.) Also note that there are some issues with the November 2015 version of the ADK related to the use of the DISM component after MDT launches an HTA. See https://blogs.technet.com/b/mniehaus/archive/2015/12/31/updated-remove-apps-script-and-a-workaround.aspx for more details.
Next, you need to modify your task sequences. Online, it should look something like this (with the steps running in the new OS):
Offline, it will look similar but the steps will be in a different location:
In either case, the “Set-ExecutionPolicy Bypass” step looks like this:
I also mentioned that the default behavior is to remove all apps. What if you don’t want to remove all apps? With previous scripts, we suggested modifying the script to change the list of apps that needs to be removed, but that can be rather tedious and requires knowing how to query the list (using Get-AppxPackage and Get-AppxProvisionedPackage). So this script will write out an XML file, RemoveApps.xml, when it runs. That contains the full list of apps. So if you want to do a subset, just edit that file to remove the apps that you don’t want removed, then save the resulting file in the same location as the RemoveApps.ps1 script. The script will find it and use that list instead of the full list. (Note that if you use this with different OSes, you’ll want to use different lists. So you may need multiple RemoveApps.xml files. The script should pick up the file from the working folder specified in the task sequence.)
But what about the apps that can’t be removed? There are several provisioned apps that Windows 10 won’t allow you to remove, so the script won’t even see those when it queries for the list. So there will be apps remaining even if you say to remove “all” apps. There’s no way around this. (If there are some apps that you want to remove but you can’t, submit feedback via the Windows Feedback app.)
NOTE: The attached script has been updated to version 1.1 as of 2015/12/30.
Comments
- Anonymous
November 11, 2015
Alternative:
Removing Built-in apps from Windows 10 WIM-File with Powershell - Version 1.1
https://gallery.technet.microsoft.com/Removing-Built-in-apps-65dc387b - Anonymous
November 11, 2015
I still haven't used powershell scripts in task sequences so I don't know but is the Set-ExecutionPolicy step really necessary if you just want to run a single powershell based task?
Couldn't it be enough to add the executionpolicy parameter to powershell.exe like this?
powershell.exe -executionpolicy Bypass -file "%ScriptRoot%RemoveApps.ps1" - Anonymous
November 11, 2015
I tried it, it didn't work. I didn't take the time to investigate, it was easy enough to fix it in a separate step :-) - Anonymous
November 11, 2015
This works for sure ;-)
http://ccmexec.com/2015/08/removing-built-in-apps-from-windows-10-using-powershell/ - Anonymous
November 12, 2015
Thanks for this post.
In Windows 8.1 there was a possibility to 'customize' the start screen editable for the user by copying a rerference AppsFolderLayout.bin into "%SystemDrive%UsersDefaultAppDataLocalMicrosoftWindowsAppsFolderLayout.bin" during TaskSequence.
Do you know if this is still possible in Windows 10 or do I have to test it myself? :) - Anonymous
November 13, 2015
What annoyed me with doing this was that a number of Updates to the built-in app's were released. eg Bing Finance, Bing Travelhttps://support.microsoft.com/en-us/kb/3081398 andhttps://support.microsoft.com/en-us/kb/3081399 etc and so caused a number of failures with updates because they didn't actually exist on the machine to get updated - Anonymous
November 13, 2015
Michael:
I seemed to follow all of the steps except that when powershell is run in offline mode the get-appxpackage cmdlet is missing from powershell. I am running the new November ADK but it seems to be missing.
--Tracy - Anonymous
November 13, 2015
Where can I get the November ADK? - Anonymous
November 15, 2015
I forgot one step in the instructions: You need to make sure the .NET Framework, PowerShell, and DISM Cmdlets are added to your Windows PE boot image.
The new ADK is available at the same download location as the old one (it replaced the old one),https://msdn.microsoft.com/en-us/windows/hardware/dn913721.aspx#adkwin10. - Anonymous
November 16, 2015
@Lee Bowman, did you find this Offline, Online or both? I would expected that behaviour for Online only. - Anonymous
November 16, 2015
@Michael, I noticed that Remove-App function sets CmdletBinding() at the start that makes
the function operate like compiled cmdlet that is written in C#. Why was it necessary to do this? - Anonymous
November 16, 2015
In offline mode, it is having an issue loading the dism module assembly from powershell which is where the error is coming from.
--Tracy - Anonymous
November 16, 2015
@MIchael, Does the script works to Upgrade scenarios ?
Thanks
Eduardo - Anonymous
November 16, 2015
It should, yes, but it would need to be used online (after the new OS is installed).- Anonymous
March 30, 2016
Hi Michael,I've successfully used this in a Deployment Task Sequence and it works great, however, this doesn't seem to work at all in an in place upgrade task sequence, even when it is running online. I even tried to manually run it from within the OS as an Admin. I'm seeing a lot of errors saying "Unable to find package" and "Unable to find provisioned package"
- Anonymous
- Anonymous
November 16, 2015
The comment has been removed - Anonymous
November 17, 2015
The comment has been removed - Anonymous
November 17, 2015
Hi Michael,
If we run this in online mode; where do we store the .xml if we do not want to uninstall all apps? - Anonymous
November 17, 2015
It will look for the XML file in the working directory, so put it wherever you set that to in the task sequence step. - Anonymous
November 18, 2015
Hi Michael,
I'm getting the same issues as Tracey and Jason with regard DISM Cmdlets not functioning when offline in WinPE. Interestingly this does not happen when you generate the image in SCCM or if manually create WinPE boot image with the same ADK. I have raised a bug for this on connect: https://connect.microsoft.com/ConfigurationManagervnext/feedback/details/2029915.
I have also tried generating just the LiteTouchPE (x64) boot image without the .NET, PowerShell and DISM Cmdlet features. Then, adding the features manually to the wim with DISM and then regenerating the ISO. Unfortunately still no joy. - Anonymous
November 18, 2015
Hi Michael,
I'm getting the same issues as Tracey and Jason with regard DISM Cmdlets not functioning when offline in WinPE. Interestingly this does not happen when you generate the image in SCCM or if manually create WinPE boot image with the same ADK. I have raised a bug for this on connect: https://connect.microsoft.com/ConfigurationManagervnext/feedback/details/2029915.
I have also tried generating just the LiteTouchPE (x64) boot image without the .NET, PowerShell and DISM Cmdlet features. Then, adding the features manually to the wim with DISM and then regenerating the ISO. Unfortunately still no joy. - Anonymous
November 18, 2015
Hi Michael,
I'm getting the same issues as Tracey and Jason with regard DISM Cmdlets not functioning when offline in WinPE. Interestingly this does not happen when you generate the image in SCCM or if manually create WinPE boot image with the same ADK. I have raised a bug for this on connect: https://connect.microsoft.com/ConfigurationManagervnext/feedback/details/2029915.
I have also tried generating just the LiteTouchPE (x64) boot image without the .NET, PowerShell and DISM Cmdlet features. Then, adding the features manually to the wim with DISM and then regenerating the ISO. Unfortunately still no joy. - Anonymous
November 18, 2015
Hi Michael,
I'm getting the same issues as Tracey and Jason with regard DISM Cmdlets not functioning when offline in WinPE. Interestingly this does not happen when you generate the image in SCCM or if manually create WinPE boot image with the same ADK. I have raised a bug for this on connect: https://connect.microsoft.com/ConfigurationManagervnext/feedback/details/2029915.
I have also tried generating just the LiteTouchPE (x64) boot image without the .NET, PowerShell and DISM Cmdlet features. Then, adding the features manually to the wim with DISM and then regenerating the ISO. Unfortunately still no joy. - Anonymous
November 18, 2015
Hi Michael,
I'm getting the same issues as Tracey and Jason with regard DISM Cmdlets not functioning when offline in WinPE. Interestingly this does not happen when you generate the image in SCCM or if manually create WinPE boot image with the same ADK. I have raised a bug for this on connect: https://connect.microsoft.com/ConfigurationManagervnext/feedback/details/2029915.
I have also tried generating just the LiteTouchPE (x64) boot image without the .NET, PowerShell and DISM Cmdlet features. Then, adding the features manually to the wim with DISM and then regenerating the ISO. Unfortunately still no joy. - Anonymous
November 18, 2015
Apologies, please remove duplicates if possible... - Anonymous
November 18, 2015
Hi Micheal,
My colleague Surjit Khera and I have come up with a work around. It would appear that Microsoft.Dism.PowerShell.dll in X:WindowsSystem32WindowsPowerShellv1.0ModulesDism gets corrupted at boot up time. If one copies the same dll from %Deployroot%Servicingx64 to X:WindowsSystem32WindowsPowerShellv1.0ModulesDism. This resolves the issue. Surj has blogged this @https://deploymentpros.wordpress.com/2015/11/18/dism-cmdlets-fail-to-run-in-win-pe-with-mdt-2013-update-1-workaround/ - Anonymous
November 19, 2015
Hi Michael,
This is a nice write up. One question, is there a way to add back a single app after removal without reinstalling the OS or downloading from the Windows Store?
Thank you.- Anonymous
March 28, 2016
The comment has been removed
- Anonymous
- Anonymous
November 23, 2015
Finally a remove apps script that works great! I've had hit and miss luck with many others. Might be related to the Windows 10 1511, but I do see three apps still there: Candy Crush Soda Saga, Surface, and Twitter - Anonymous
November 25, 2015
Hi,
I would like to keep the calculator, is this possible?
Rgds,
Victor - Anonymous
November 25, 2015
Sure, just build a file that specifies what apps you want to remove, instead of accepting the default which is to remove everything. - Anonymous
November 25, 2015
I actually ended up doing something different. In this case I will keep the "accepted" built in apps.
# No list? Build one with all apps.
Write-Verbose "Building list of provisioned apps"
$list = @()
Get-AppxProvisionedPackage -online | Where-Object {$.DisplayName -notlike 'Windows'} | % { $list += $.DisplayName}
# Write the list to the log path
$logDir = Get-LogDir
$configFile = "$logDirRemoveApps.xml"
$list | Set-Content $configFile
Write-Information "Wrote list of apps to $logDirRemoveApps.xml, edit and place in $dataDir to use that list for future script executions"
} - Anonymous
December 02, 2015
Is there any way to prevent the apps from reinstalling? They keep coming back even though I ran the script in OS and during build and capture. I also had it run during my LTI-MDT task sequence and they still came back eventually.
Thoughts on preventing this? - Anonymous
December 04, 2015
How can we also get rid of the flipboard, twitter, candy crush, minecraft, etc items from appearing on the start menu? These don't appear to be appx packages, but I'd still like them gone. - Anonymous
December 04, 2015
See the next blog for that one, http://blogs.technet.com/b/mniehaus/archive/2015/11/23/seeing-extra-apps-turn-them-off.aspx - Anonymous
December 04, 2015
On the question about apps reinstalling, what apps are reinstalling? When the provisioned apps are removed, they wont' uninstall. But if these are apps pushed from the store (seehttp://blogs.technet.com/b/mniehaus/archive/2015/11/23/seeing-extra-apps-turn-them-off.aspx), then they will be pushed to each user. So it's not so much that they are "coming back", it's really that they are being pushed for each user. - Anonymous
December 04, 2015
Thanks Michael. This is perfect. Some top notch helpful stuff! - Anonymous
December 08, 2015
I thought the newest ADK was not recommended for configmgr? - Anonymous
December 15, 2015
Michael, I have utilized the powershell script you show in the post install section (while still in WinPE). The COMObject does not load and does not expose the variables for the log share. Is there any update when the x64 WinPE will have x64 powershell available to utilize those variables? - Anonymous
December 15, 2015
I stand corrected... Need to finish testing while a TS is running. - Anonymous
December 16, 2015
Hey guys. Thank you Michael for the fantastic blog entry! I've managed to use this script successfully in MDT task sequence. However I can't seem to find a way to disable the selected apps from all the users. Or should this script do that? The apps are removed just fine from the local user but for example when logging in with new domain credentials all the apps get pushed to the new user. Have you got found a way to avoid that? - Anonymous
December 17, 2015
Duke, there is a cmdlet for that: Remove-AppxProvisionedPackage, it does not remove current apps, but it prevents installs for new users. I haven't tested it myself though. Found the information here:http://mikefrobbins.com/2015/08/20/remove-app-packages-from-windows-10-enterprise-edition/ - Anonymous
December 22, 2015
Hi,
Anyone had luck with this? I've tried almost everything and always getting the error: The system cannot find the file specified.
BTW..its needed to add storage cmdlet since the script is using the get-volume to list the volumes and its necessary to use the workaround to delete and copy the DISM cmdlets.
Thank you. - Anonymous
December 26, 2015
The comment has been removed - Anonymous
December 30, 2015
Thanks a lot for this script. I have a little correction though for the "Offline Mode" If you don't use an XML file this fails in the "Get-AppList" part, since the Offline condition is not checked.
Replace: Get-AppxProvisionedPackage -online | % { $list += $.DisplayName }
With:
if ($env:SYSTEMDRIVE -eq "X:")
{
$script:Offline = $true
# Find Windows
$drives = get-volume | ? {-not [String]::IsNullOrWhiteSpace($.DriveLetter) } | ? {$.DriveType -eq 'Fixed'} | ? {$.DriveLetter -ne 'X'}
$drives | ? { Test-Path "$($.DriveLetter):WindowsSystem32"} | % { $script:OfflinePath = "$($.DriveLetter):" }
Write-Verbose "Eligible drive found: $script:OfflinePath"
Get-AppxProvisionedPackage -Path $script:OfflinePath | % { $list += $.DisplayName }
}
else
{
Get-AppxProvisionedPackage -online | % { $list += $.DisplayName }
}
This will fix the issue. (Basically copied the part from the removal function here as well.)
I still needed to include the fix for the DISM problem in MDT 2013 U2 - Anonymous
December 30, 2015
I just posted an updated script a couple of hours ago with a fix for that Get-AppList issue. I'm working on a blog with a better workaround for the issue with loading the DISM PowerShell module in Windows PE, should be posted soon. - Anonymous
December 31, 2015
I’ve updated the script attached to http://blogs.technet.com/b/mniehaus/archive/2015/11/11/removing-windows - Anonymous
January 22, 2016
I successfully used the updated script to create a Windows 8.1 and Windows 10 reference image. With Windows 8.1 everything looks fine. But with Windows 10 it looks like that the Windows Store app itself is also removed. How can I add the store back? - Anonymous
January 22, 2016
Great post, i managed to remove all non professional apps (on Windows pro... ugh). Just a detail : Ensure to have the latest ADK or that script won-t work offline. I had the august 2015 version and it did not work. - Anonymous
January 27, 2016
The comment has been removed - Anonymous
January 28, 2016
Hi Everyone. Thank you for the script. I use it in my TS and all apps like Xbox for example are gone at the end of the OSD.
But, i did an inplace upgrade from 10.0.240 to Windows 10 1511 with sccm current branch on my already deployed workstations and all this apps are back with the new version of Windows 10. How can i deploy upgrades and uninstall this apps at the same time ? Thanks - Anonymous
February 03, 2016
Like Renaud, I have also found that an inplace upgrade from 10.0.240 to 10.0.586 re-installed all the Universal applications that were removed during Image build and capture.- Anonymous
May 11, 2016
And makes that impossible to sysperp because it is an "upgrade" .Install original iso and start again.
- Anonymous
- Anonymous
February 19, 2016
I tried it and it removed most apps except 3D Builder, Skype Video, OneNote, Solitaire, Maps, Phone, Phone Companion, Sports, Sway and Get Office
Error says "Unable to find installed app" and the list includes Microsoft.Office.OneNote and 13 other apps.
It also deleted the Store app.
How can this be fixed so it doesn't delete the Store, but deleted the apps I listed above? - Anonymous
February 19, 2016
It didn't remove those apps from the administrator profile, but when I logged in with a new user profile, the remaining apps were gone. Only apps remaining are the "unremovable" apps Contact Support, Cortana, Edge and Windows Feedback.
Unfortunately, the Store app was still gone and we need it back.
I thought the Store was also "unremovable," and has no way to reinstall if you find ways to remove it?
I'd rather remove Contact Support and Windows Feedback since our users should never be using those apps for tech support on the company workstations. - Anonymous
February 28, 2016
Great script and I have it working well in my environment, However I am having trouble finding the location of the output RemoveApps.xml that the script creates. Can someone point me in the right direction here? - Anonymous
February 29, 2016
It should be in the %temp% - Anonymous
March 01, 2016
Big problem with the Windows Store app being removed. Anyone have a solution for this? - Anonymous
March 24, 2016
Is anything being done about Windows re-installing all the Universal applications when moving between builds? I hope this is fixed in Redstone in July. - Anonymous
March 24, 2016
For some reason, even when this is added to the PostInstall section of the task sequence, Get-AppxPackages list all the apps after I logon for the first time. - Anonymous
April 08, 2016
It seem like a nice script, but it leaves broken empty icons in the startmenu after uninstall. - Anonymous
April 13, 2016
You should not need to have a bypass step. MDT 2013 U1 and U2 run PS scripts with bypass built in. - Anonymous
April 26, 2016
Any suggestions how to manage after an upgrade when all these unwanted apps are reinstalled? My thoughts are to look at LTSB again or just stick with customizations from Group Policy and CBB. Any other thoughts? - Anonymous
May 11, 2016
The comment has been removed - Anonymous
June 10, 2016
This fully works for me.However, when updating from 10240 to 10586, all the apps reinstalled.Are we going to have to deal with that with Anniversary Update (1607)? If so, we may need to stop deploying Windows 10 for now until this gets fixed.Please let me know. - Anonymous
June 16, 2016
The comment has been removed - Anonymous
June 23, 2016
This script worked great during OSD to remove ALL apps. But I cannot locate the removeapps.xml file to create a list to save some of the apps I would like to remain. Can someone help me locate it or show me a template so I can create one? - Anonymous
July 11, 2016
Thanks for the post Michael, much appreciated.I have a running network of Win 10 Pro's. Wanting to implement this on them. I am afraid of the OS updating the apps currently installed while the script is running and corrupting the app, I've read this could occur and probably had it happen in my network. Is there a way I can query when these apps are being updated or include in the script a way to stop the updating or tell it to not update for the duration of the script at the top of the script? - Anonymous
July 14, 2016
This worked perfectly in SCCM. Thank you. - Anonymous
July 26, 2016
This is great for removing most of the pesky applications, but after doing this the Windows Store app will not work. Also, there is no way to load any of the apps you removed because of this. It is very annoying. I am having a lot of trouble fixing it. The Windows Store app loads for just a few seconds and then closes. - Anonymous
August 10, 2016
Works like a charm! Thanks! But strange is the action output:The task sequence execution engine successfully completed the action (Remove Apps) in the group (Global) with exit code 0Action output: ... 攀爀眀攀渀搀攀渀 匀椀攀 䜀攀琀ⴀ䄀瀀瀀砀倀愀挀欀愀最攀Ⰰ 甀洀 搀椀攀 䰀椀猀琀攀 搀攀爀 椀渀猀琀愀氀氀椀攀爀琀攀渀 倀愀欀攀琀攀 ഀ嘀牥敷摮湥匠敩䜠瑥䄭灰偸捡�椀琀礀䤀搀崀 㜀攀㘀㐀攀㘀㤀㠀ⴀ昀㌀㤀搀ⴀ ㌀ⴀ愀攀攀㠀ⴀ㘀㐀㜀攀㤀搀昀㌀搀 ∀Ⰰ ഀ䔀敲杩楮灳潲潴潫汬渠捡嬢捁楴楶祴摉⁝攷㐶㙥㠹昭㤳ⵤ〰㌰愭敥ⴸ㐶攷搹㍦ㅤ�quence\Packages\CH1000F3\RemoveApps.ps1:190 Zeichen:20湉䌠尺卟卍慔歳敓畱湥散停捡慫敧屳䡃〱〰㍆剜浥癯䅥灰獰㨱㤱‰敚捩敨㩮〲+ $current | Remove-AppxPackage††††挤牵敲瑮簠删浥癯ⵥ灁硰慐正d: (Microsoft.Windo...__8wekyb3d8bb ††慃整潧祲湉潦†††††›扏敪瑣潎䙴畯摮›䴨捩潲潳瑦圮湩潤⸮弮㡟敷祫㍢㡤扢† 眀攀㨀匀琀爀椀渀最⤀ 嬀刀攀洀漀瘀攀ⴀ䄀瀀瀀砀倀愀挀欀愀最攀�.