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:

(35121)

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… 🙁

  • 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”

  • Leave a Reply

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