Since the release of Windows 10, it has been common for organization to try and reduce the footprint of built-in apps (or default apps) in their reference images, or even during bare-metal deployment. Over the years, the community has provided several solutions on how to accomplish this including myself. During this time, I’ve attempted to keep my script updated after each new release of Windows 10. You’ll find the post about the method I’m using in the script and how to use it when creating a reference image here:

Remove Built-in apps when creating a Windows 10 reference image

Going forward, instead of updating that blog post for each Windows 10 release, I’ve decided to create a new post instead with information on what has changed or been added in the script (if any).

Download script

I’ve made the script available on our GitHub repository along with all the other scripts that we’ve shared, and it’s available on the following URL:

https://github.com/SCConfigMgr/ConfigMgr/blob/master/Operating%20System%20Deployment/Invoke-RemoveBuiltinApps.ps1

What’s new

Below is a list of changes and additions made to the latest version of the script:

  • In the previous version of this script, the capability to remove Feature On Demand V2 packages could produce an error that many ran into when using the script. I also  encountered issues after the initial release of the script and later found that the Get-WindowsCapability cmdlet in Windows 10 version 1709 and earlier, didn’t expose the same functionality as found with dism.exe. Now with Windows 10 version 1803, the Get-WindowsCapability cmdlet now has -LimitAccess switch that seems to workaround the issue that occurred. This switch simply just tells Windows to skip checking for capabilities from Windows Update and the cmdlet returns what’s installed on the system. So, in the latest version of this script, that switch has been added when the Get-WindowsCapability cmdlet is used. Logic to support older versions that Windows 10 version 1803 has also been added to this new version of the script
  • Media.WindowsMediaPlayer has now been added to the white list for Feature On Demand V2 packages.
  • Microsoft.MicrosoftOfficeHub, Microsoft.MicrosoftStickyNotes, and Microsoft.WindowsAlarms has now been added to the white list for appx packages.
  • A few modifications has been made to the logging part of the script.

Using the script

Reference the previous instructions from the original post mentioned above. I highly encourage you to also implement the solution at the bottom from Johan’s blog about how to turn of the automatic app updates from the Windows Store.

https://deploymentresearch.com/Research/Post/615/Fixing-why-Sysprep-fails-in-Windows-10-due-to-Windows-Store-updates

Below is a few screenshot of how I’m using this script to remove the built-in apps along with Johan’s scripts:

Here’s one from when you enable the app updates from Windows Store at the end before creating the WIM file:

Before and after running the script

When using this script, either when creating a reference image or during bare metal deployment here the outcome of what the script in fact removes. Below is a screenshot from a Windows 10 version 1803 system before the script was executed:

And here’s the same system after the script was executed:

As for Feature On Demand V2 packages, the following remains on the same system as above after the script has executed successfully:

(54494)

Nickolaj Andersen

Principal Consultant and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Currently working for TrueSec as a Principal Consultant. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences and user groups.

comments
  • Greg
    Posted at 23:52 May 13, 2018
    Greg
    Reply
    Author

    It looks like my organization has finally taken to the idea of just leaving all of the apps and using AppLocker to block those that we don’t want. While I liked the idea of removing the apps; when we started using the Windows 10 servicing model in SCCM, every time we got a new feature update, we would get more apps. Believe me when I tell you that life is just easier if you stop fighting the Microsoft model and just go with it.

    • Nickolaj Andersen
      Posted at 11:55 May 16, 2018
      Nickolaj Andersen
      Reply
      Author

      Yeah I agree, but it would be a better world if the build from Microsoft would actually be enterprise worthy from the beginning 🙂

      Regards,
      Nickolaj

    • AlLeluya
      Posted at 12:01 May 23, 2018
      AlLeluya
      Reply
      Author

      This appx (provisioned, installed, changing names between versions, etc.) model is fundamentally flawed. I am struggling with the original M.Nihaus’s script whcih is supposed to be removing apps (1703 in my case) – problem is it does not always work.
      The PS commands simply do not see certain apps – provisioned or installed.

      Btw. (to the author) are you using the same script at the beginning and the end of your TS?
      Invoke-RemoveBuiltinApps.ps1

      • AlLeluya
        Posted at 12:03 May 23, 2018
        AlLeluya
        Reply
        Author

        Please disregard this – I misread the screenshots:
        Btw. (to the author) are you using the same script at the beginning and the end of your TS?
        Invoke-RemoveBuiltinApps.ps1

        • Nickolaj Andersen
          Posted at 08:53 May 29, 2018
          Nickolaj Andersen
          Reply
          Author

          Hi,

          Yeah, it’s a missconfiguration actually. Should have updated that image. I only run it once before any Windows Update steps.

          Regards,
          Nickolaj

  • Thomas Ehler
    Posted at 14:10 May 14, 2018
    Thomas Ehler
    Reply
    Author

    Hi Nikolaj

    Pfffhhh… well I guess I’m just old and tired but I just hammer a Layoutmodification.xml onto the Defaultuser during deployment. With the modification overlay the users get a clean slade with just what they need..

    Those 220Mb Modern.App junk isn’t more than a few temp- or cache files use…
    powershell -executionpolicy bypass Import-StartLayout -LayoutPath ‘.\StartmenuLayout\2016×86\LayoutModification.xml’ -MountPath c:\ -verbose

    (2016×86 refers to our overlay file with 32bit Office 2016 🙂

  • Marcin Rybarczyk
    Posted at 09:38 May 15, 2018
    Marcin Rybarczyk
    Reply
    Author

    Is there any method to block Microsoft push apps that are being downloaded via user after first login in Windows 10 PRO version (not Enterprise), I know that I can’t use GPO or Applocker in Professional version.

  • Prajwal Desai
    Posted at 12:38 May 16, 2018
    Prajwal Desai
    Reply
    Author

    I want to really try this.. Fed up of finding way to Uninstall built-in apps. I was trying to sysprep a windows 10 1803 VM and one of the built-in app wasn’t allowing me to do that. Let me try your script. Good job

    • Nickolaj Andersen
      Posted at 18:23 May 16, 2018
      Nickolaj Andersen
      Reply
      Author

      Remember to add the scripts that I reference in the post from Johan.

  • Daniel
    Posted at 09:43 May 30, 2018
    Daniel
    Reply
    Author

    This script has too not worked for me. Tried nearly everything to remove them but seems maybe it gets installed again or I dont know… 🙁

    • TP
      Posted at 17:35 July 5, 2018
      TP
      Reply
      Author

      Yes this is whats happening to me after sysprep.

  • Matt Keppler
    Posted at 17:02 June 19, 2018
    Matt Keppler
    Reply
    Author

    Hi there,

    Great script. It works flawless when running from ISE. When I put it into my TS, however, it bombed out stating:
    The term ‘Get-AppxPackage’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. TaskSequencePSHost 6/19/2018 3:29:21 PM 0 (0x0000)
    At \\REDACTED\Deploy10v1803\Scripts\RemoveBuiltinApps.ps1:26 char:17
    + $AppArrayList = Get-AppxPackage -PackageTypeFilter Bundle -AllUsers | …
    + ~~~~~~~~~~~~~~~ TaskSequencePSHost 6/19/2018 3:29:21 PM 0 (0x0000)
    ObjectNotFound: (Get-AppxPackage:String) [], CommandNotFoundException TaskSequencePSHost 6/19/2018 3:29:21 PM 0 (0x0000)
    TSHOST: Script completed with return code 0 TaskSequencePSHost 6/19/2018 3:29:21 PM 0 (0x0000)

    I tried using the “Run Powershell Script” task sequence item as well as “Run Command Line” task sequence item “using powershell.exe -file “%ScriptRoot%\RemoveBuiltinApps.ps1”

    • John Andre
      Posted at 12:21 July 11, 2018
      John Andre
      Reply
      Author

      Try to run the script in the state restore phase (full OS). Worked for me.

  • AGB
    Posted at 03:02 June 20, 2018
    AGB
    Reply
    Author

    Nicolaj – Your script combined with Johans instruction worked perfectly. Thanks a bunch. The only problem is that cortana is still not removed. Am I missing something with regards to Cortana?

  • Michael
    Posted at 13:05 June 29, 2018
    Michael
    Reply
    Author

    Ok, I tried the script but it isn’t working. The step before to disable Windows Update (Johan) Store is working but after that I run your script and it gives me an error. This is the step to execute your script;

    Type: Run PowerShell Script
    Package : Windows 10 Scripts
    ScriptName: “.\Invoke-RemoveBuiltinApps.ps1”
    Parameters: *empty*
    PowerShell Execution Policy: ‘bypass’

    This is the error:

    The argument ‘Invoke-RemoveBuiltinApps.ps1’ to the -File parameter does not exist. Provide the path to an existing ‘.ps1’ file as an argument to the -File parameter.
    Failed to run the action: Remove Appx and Metro.
    Unknown error (Error: FFFD0000; Source: Unknown) TSManager 29/06/2018 12:15:31 3032 (0x0BD8)
    Set authenticator in transport TSManager 29/06/2018 12:15:31 3032 (0x0BD8)
    Set a global environment variable _SMSTSLastActionRetCode=-196608 TSManager 29/06/2018 12:15:31 3032 (0x0BD8)
    Set a global environment variable _SMSTSLastActionSucceeded=false TSManager 29/06/2018 12:15:31 3032 (0x0BD8)
    Clear local default environment TSManager 29/06/2018 12:15:31 3032 (0x0BD8)
    Let the parent group (Customizations – WIN10) decides whether to continue execution TSManager 29/06/2018 12:15:31 3032 (0x0BD8)
    The execution of the group (Customizations – WIN10) has failed and the execution has been aborted. An action failed.
    Operation aborted (Error: 80004004; Source: Windows) TSManager 29/06/2018 12:15:31 3032 (0x0BD8)
    Failed to run the last action: Remove Appx and Metro. Execution of task sequence failed.
    Unknown error (Error: FFFD0000; Source: Unknown) TSManager 29/06/2018 12:15:31 3032 (0x0BD8)

  • Josh
    Posted at 19:13 July 3, 2018
    Josh
    Reply
    Author

    Hi , I have an error with script to disable Windows store update
    what are the prerequisites ? Net framwork
    Dism cmlets ?
    Thank’s for your help

  • TP
    Posted at 17:34 July 5, 2018
    TP
    Reply
    Author

    Apps come back after sysprep, for me at least. Am I missing something here.

  • John Andre
    Posted at 12:19 July 11, 2018
    John Andre
    Reply
    Author

    Matt .. where are youn running the script ? Try to run it in the state restore phase from full OS.

  • Matt Lowe
    Posted at 14:46 July 11, 2018
    Matt Lowe
    Reply
    Author

    I am also getting the same error as Matt Keppler,

    Any suggestions?

    Matt

  • David
    Posted at 14:59 July 25, 2018
    David
    Reply
    Author

    This does not work at all for me. After running it in Powershell ISE as Administrator, and then looking at the log, I find that everything it attempted to remove fails with either “Unspecified error” or “Access is denied”.

  • Nick
    Posted at 21:30 August 7, 2018
    Nick
    Reply
    Author

    Same with me, I put the script on %SCRIPTROOT% -Script folder but I got the same error with both! I am curious what is the real workflow to make those scripts working in TS!?

  • Silvio
    Posted at 12:14 August 30, 2018
    Silvio
    Reply
    Author

    Hey Nickolay, i try ur script with a fresh W10E 1803 machine – created the first account (local admin) and I get several errors when trying to uninstall some provisioned apps, why is this?

    For example:
    Removing AppxPackage: Microsoft.Microsoft3DViewer_2.1803.8022.0_x64__8wekyb3d8bbwe
    Removing AppxProvisioningPackage: Microsoft.Microsoft3DViewer_2.1803.8022.0_neutral_~_8wekyb3d8bbwe
    Removing AppxProvisioningPackage ‘Microsoft.Microsoft3DViewer_2.1803.8022.0_neutral_~_8wekyb3d8bbwe’ failed: access denied

    This happens for People, Wallet, Camera, Microsoft.Xbox.TCUI_1.11.28003.0_neutral_~_8wekyb3d8bbwe

  • raj
    Posted at 12:06 September 5, 2018
    raj
    Reply
    Author

    Hi,
    Can I use it for the older version also ?
    You added under state restore and custom tasks ( Posts windows update )
    Thanks

  • Kyle
    Posted at 20:57 September 18, 2018
    Kyle
    Reply
    Author

    Only problem I ran into was Microsoft.Whiteboard package…Must need a small tweak to the script?

  • Garrett
    Posted at 14:38 October 19, 2018
    Garrett
    Reply
    Author

    Hi Nikolaj, thanks for the post! Will this work in the In-Place Upgrade task sequence? If so, does it matter where it is? I had it placed at the end of the TS (no Windows updates enabled), it made a log with a “o” return code, but it didn’t appear to have worked until I ran it manually post upgrade. Thanks again for the great resource.

  • Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.