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 http://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):

image

Offline, it will look similar but the steps will be in a different location:

image

In either case, the “Set-ExecutionPolicy Bypass” step looks like this:

image

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.

RemoveApps.zip

Comments (59)

  1. MisterDotCom says:

    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

  2. Per says:

    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"

  3. 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 🙂

  4. MK-Maddin says:

    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? 🙂

  5. Lee Bowman says:

    What annoyed me with doing this was that a number of Updates to the built-in app’s were released. eg Bing Finance, Bing Travel
    https://support.microsoft.com/en-us/kb/3081398 and
    https://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

  6. Tracy Ratz says:

    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

  7. Luke says:

    Where can I get the November ADK?

  8. 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.

  9. GJHardie says:

    @Lee Bowman, did you find this Offline, Online or both? I would expected that behaviour for Online only.

  10. GJHardie says:

    @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?

  11. Tracy Ratz says:

    In offline mode, it is having an issue loading the dism module assembly from powershell which is where the error is coming from.

    –Tracy

  12. Eduardo Zarpelao says:

    @MIchael, Does the script works to Upgrade scenarios ?

    Thanks
    Eduardo

  13. It should, yes, but it would need to be used online (after the new OS is installed).

  14. If you didn’t add the "DISM Cmdlets" component to Windows PE, you won’t be able to load the DISM module for offline removal.

    If you are seeing this error even with PowerShell, .NET, and DISM Cmdlet components installed, let me know – I’ve seen this sporatically. You might try rebuilding the boot image.

  15. Jason says:

    How do you upgrade the Windows 10 ADK? Uninstall – Reboot – Reinstall? I’m getting powershell errors (shocker) in my task sequences, and I have the DISM cmdlets, Powershell and the .NET Framework all installed on my PE images.

  16. Matthew says:

    Hi Michael,

    If we run this in online mode; where do we store the .xml if we do not want to uninstall all apps?

  17. It will look for the XML file in the working directory, so put it wherever you set that to in the task sequence step.

  18. GJHardie says:

    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.

  19. GJHardie says:

    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.

  20. GJHardie says:

    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.

  21. GJHardie says:

    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.

  22. GJHardie says:

    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.

  23. GJHardie says:

    Apologies, please remove duplicates if possible…

  24. GJHardie says:

    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/

  25. Jerry says:

    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.

  26. Steve says:

    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

  27. Anonymous says:

    A few weeks ago, I published a script to help remove the in-box apps from a Windows 10 image . Some people

  28. Victor says:

    Hi,

    I would like to keep the calculator, is this possible?

    Rgds,
    Victor

  29. Sure, just build a file that specifies what apps you want to remove, instead of accepting the default which is to remove everything.

  30. Victor says:

    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"
    }

  31. Anon says:

    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?

  32. Aaron says:

    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.

  33. 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 (see

    http://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.

  34. Aaron says:

    Thanks Michael. This is perfect. Some top notch helpful stuff!

  35. Aaron S says:

    I thought the newest ADK was not recommended for configmgr?

  36. Thad says:

    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?

  37. Thad says:

    I stand corrected… Need to finish testing while a TS is running.

  38. Duke says:

    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?

  39. Niels says:

    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/

  40. Valter Anjos says:

    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.

  41. Miroslaw says:

    Per asked:
    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?

    If your powershell.exe uses a script-block approach to do work, is therefore self-contained and is not calling any script, if so, then you should not need to change the execution policy.

  42. vendolis says:

    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

  43. 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.

  44. Gucky says:

    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?

  45. Romain says:

    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.

  46. TribleTrouble says:

    There is a way around the apps you cant uninstall. You can Block them With AppLocker.

  47. Renaud says:

    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

  48. Aymann says:

    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.

  49. aw says:

    hai, I just want to tell you that I am just very new to blogs and seriously loved this website. More than likely I’m planning to bookmark your blog post .
    You amazingly come with really good posts. Thanks a lot for sharing your blog Microsoft.

    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Aceh
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Bali
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Balikpapan
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Bandung
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Banjarmasin
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Banten
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Batam
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Bekasi
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Bengkulu
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Bogor
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Bontang
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Cianjur
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Cikarang
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Cilegon
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Cirebon
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Denpasar
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jakarta
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jambi
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jember
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Karawang
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kendal
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kudus
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kupang
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Lampung
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Madiun
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Makasar
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Malang
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Maluku
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Manado
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Medan
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20NTT
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Padang
    http://www.lokerjobindo.com
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20BUMN
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20SMA
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Terbaru

  50. Mygposts says:

    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?

  51. Mygposts says:

    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.

  52. Scotty_E says:

    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?

  53. KH says:

    It should be in the %temp%

  54. JFMartel says:

    Big problem with the Windows Store app being removed. Anyone have a solution for this?

  55. Anthony says:

    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.

  56. Jonathan says:

    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.