MSEndpointMgr

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

When creating your reference image for Windows 10, you might want to remove the Universal Apps for various reasons. The community have come up with several scripts to accomplish this task, and don’t want to take any credit for coming up with the idea to do it with PowerShell. However, I wanted to share my version of a PowerShell script that removed the built-in apps in Windows 10.
In this script, I’ve taken another approach compared to those created by other community members. Since new versions of Windows 10 will emerge 2-3 times a year, I don’t want to update a script to support the new version that might incorporate new Universal Apps. Instead, I’m white-listing Universal Apps that I want to keep (like the Calculator), and remove everything else. In my experience, this should lead to the least amount of maintenance and that’s what I’m all about.

Script

As with the release of Windows 10 1607, a few more apps were added compared to Windows 10 version 1511. Edit the WhiteListedApps variable and make the changes that you seem fit in terms of which apps that should not be removed. As for Features on Demand, there’s also a white list of packages that won’t be removed when running the script. Edit the WhiteListOnDemand variable to fit your organizational requirements.

Update 2017-06-27: Script has been updated to only log output to RemovedApps.log file and not generate any errors that might cause MDT sequence to break.
Update 2017-03-23: Script updated with Write-LogEntry function to write to a log file called RemovedApps.log placed in C:\Windows\Temp. Applications like Quick Assist and Contact Support can now also be removed with this script. A bug has also been addressed causing the list of appx packages not to be fully populated.

# Functions
function Write-LogEntry {
    param(
        

[parameter(Mandatory=$true, HelpMessage=”Value added to the RemovedApps.log file.”)]

[ValidateNotNullOrEmpty()] [string]$Value,

[parameter(Mandatory=$false, HelpMessage=”Name of the log file that the entry will written to.”)]

[ValidateNotNullOrEmpty()] [string]$FileName = “RemovedApps.log” ) # Determine log file location $LogFilePath = Join-Path -Path $env:windir -ChildPath “Temp\$($FileName)” # Add value to log file try { Add-Content -Value $Value -LiteralPath $LogFilePath -ErrorAction Stop } catch [System.Exception] { Write-Warning -Message “Unable to append log entry to RemovedApps.log file” } } # Get a list of all apps Write-LogEntry -Value “Starting built-in AppxPackage and AppxProvisioningPackage removal process” $AppArrayList = Get-AppxPackage -PackageTypeFilter Bundle -AllUsers | Select-Object -Property Name, PackageFullName | Sort-Object -Property Name # White list of appx packages to keep installed $WhiteListedApps = @( “Microsoft.DesktopAppInstaller”, “Microsoft.Messaging”, “Microsoft.StorePurchaseApp” “Microsoft.WindowsCalculator”, “Microsoft.WindowsCommunicationsApps”, # Mail, Calendar etc “Microsoft.WindowsSoundRecorder”, “Microsoft.WindowsStore” ) # Loop through the list of appx packages foreach ($App in $AppArrayList) { # If application name not in appx package white list, remove AppxPackage and AppxProvisioningPackage if (($App.Name -in $WhiteListedApps)) { Write-LogEntry -Value “Skipping excluded application package: $($App.Name)” } else { # Gather package names $AppPackageFullName = Get-AppxPackage -Name $App.Name | Select-Object -ExpandProperty PackageFullName $AppProvisioningPackageName = Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -like $App.Name } | Select-Object -ExpandProperty PackageName # Attempt to remove AppxPackage if ($AppPackageFullName -ne $null) { try { Write-LogEntry -Value “Removing application package: $($App.Name)” Remove-AppxPackage -Package $AppPackageFullName -ErrorAction Stop | Out-Null } catch [System.Exception] { Write-LogEntry -Value “Removing AppxPackage failed: $($_.Exception.Message)” } } else { Write-LogEntry -Value “Unable to locate AppxPackage for app: $($App.Name)” } # Attempt to remove AppxProvisioningPackage if ($AppProvisioningPackageName -ne $null) { try { Write-LogEntry -Value “Removing application provisioning package: $($AppProvisioningPackageName)” Remove-AppxProvisionedPackage -PackageName $AppProvisioningPackageName -Online -ErrorAction Stop | Out-Null } catch [System.Exception] { Write-LogEntry -Value “Removing AppxProvisioningPackage failed: $($_.Exception.Message)” } } else { Write-LogEntry -Value “Unable to locate AppxProvisioningPackage for app: $($App.Name)” } } } # White list of Features On Demand V2 packages Write-LogEntry -Value “Starting Features on Demand V2 removal process” $WhiteListOnDemand = “NetFX3|Tools.Graphics.DirectX|Tools.DeveloperMode.Core|Language|Browser.InternetExplorer” # Get Features On Demand that should be removed $OnDemandFeatures = Get-WindowsCapability -Online | Where-Object { $_.Name -notmatch $WhiteListOnDemand -and $_.State -like “Installed”} | Select-Object -ExpandProperty Name foreach ($Feature in $OnDemandFeatures) { try { Write-LogEntry -Value “Removing Feature on Demand V2 package: $($Feature)” Get-WindowsCapability -Online -ErrorAction Stop | Where-Object { $_.Name -like $Feature } | Remove-WindowsCapability -Online -ErrorAction Stop | Out-Null } catch [System.Exception] { Write-LogEntry -Value “Removing Feature on Demand V2 package failed: $($_.Exception.Message)” } } # Complete Write-LogEntry -Value “Completed built-in AppxPackage and AppxProvisioningPackage removal process”

Using the script in MDT

1. Using this script is really no brainer, simply download it, call it Invoke-RemoveBuiltinApps.ps1 and place it in the %SCRIPTROOT% directory, meaning the <DeploymentShareRoot>\Scripts directory in MDT.
186_2
2. In your task sequence for Windows 10, add a Run PowerShell Script step and set the PowerShell Script field to:

%SCRIPTROOT%\Invoke-RemoveBuiltinApps.ps1

186_3_1
Start your reference image creation process and watch the magic happen!

(115438)

Nickolaj Andersen

Chief Technical Architect 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. 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 such as Microsoft Ignite, NIC Conference and IT/Dev Connections including nordic user groups.

113 comments

  • Hi Nickolaj,
    I’ve incorporated your script and it seems that after the Sysprep stage when it comes to create the WIM, I hang on the screen “It’s taking a bit longer than expected, but we’ll get there as fast as we can”. After about 20 minutes i come to black screen with an error message that states :
    Can not find script file “C:\LTIBootstrap.vbs”
    I did not incorporate the disable windows store btw. Do you know the cause of this or the fix? it seems i cannot get a working debloat script to work on my mdt image which only contains drivers and the PS script above. Thanks

  • Hi, with version 1709, it doesn’t make anything . Even the RemovedApps.Log is not created whatever the script sounds to run normally with the progress bar apearing on the screen….
    I’m on my end.

  • I got around error 0x800f0954 by appending -LimitAccess to Get-WindowsCapability -Online
    Don’t know what the root cause is, but the script ran without any problems.

  • Dear Nickolaj,
    I have seen this script posted any many websites.
    Are you the author?
    Is this script copyrighted?
    Is it free for use by a city government?
    Regards,

    • Hi, what you see linked on this site is developed by me. There’s various iterations by several people out there with scripts that does basically the same. Yes, it’s free for use. Regards, Nickolaj

  • Verified that this happens on an untouched vanilla 1709 ISO without any patches applied.
    Came from the “factory”
    PS C:\windows\system32> Get-WindowsCapability -Online
    Get-WindowsCapability : Get-WindowsCapability failed. Error code = 0x800f0954
    At line:1 char:1
    + Get-WindowsCapability -Online
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Get-WindowsCapability], COMException
    + FullyQualifiedErrorId : Microsoft.Dism.Commands.GetWindowsCapabilityCommand

    • I got around the error with Get-WindowsCapability by appending the -LimitAccess option.
      When executing the Get-WindowsCapability -Online cmd, I got error 0x800f0954 too. After appending -LimitAccess, I got results back.
      I adjusted the script, and it ran without any problems. Still not sure what the cause is though.

  • Hi Nickolaj
    Your script is my most preferred way to remove AppX and AppX provisioned packages, due to its white listing as opposed to blacklisting.
    However, it does not work using internet connected computers, as they update in the background during the build and generate the following error:
    2017-08-08 12:38:35, Error SYSPRP Package 89006A2E.AutodeskSketchBook_1.5.2.0_x64__tf1gferkr813w was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
    How can I resolve this or amend the script to account for these annoying background apps?
    [PS I do not want to prevent Windows from performing these background updates, because there are a number of language optional features which if not installed during the build, when they try to install after deployment/first logon it is hit and miss whether they install or not (doesn’t seem to be a pattern, its just unreliable/intermittent).]
    Thanks

  • Hi Nickolaj.
    After using this script in Windows 10 1709 and MDT a lot of built-in apps still available e.g remote desktop, bing weather, duolingo.
    Is there any way to remove this apps also?
    Harmen.

  • Hello Nickolaj,
    The direct error message from powershell is:
    Get-WindowsCapability : Get-WindowsCapability failed. Error code = 0x800f0954
    At \\svpgideploy01\e$\InstallResources\MDT\Settings\Scripts\RemoveBuildinApps\RemoveBuiltinApps.ps1:76 char:25
    + $OnDemandFeatures = Get-WindowsCapability -Online | Where-Object …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Get-WindowsCapability], COMException
    + FullyQualifiedErrorId : Microsoft.Dism.Commands.GetWindowsCapabilityCommand
    The ReovedApps.log does not show any error, the last two entries show:
    Starting Features on Demand V2 removal process
    Completed built-in AppxPackage and AppxProvisioningPackage removal process
    Kind regards,
    Jeroen Jansen

  • Hello Nickolaj,
    I have the same problem as descibed by Pierre, what kind of info do you need? maybe I can send you? We also use build 1709.

  • Hi Nick,
    Sorry, I did not get to respond right away. I have created a software package. After provisioning bitlocker, it is apps removal.
    Thanks

  • Hello, thanks for your script, in windows 1709 i have this error in MDT :
    Failed Get-WindowsCapability. error code = 0x800F0950
    line \\mdt1\mdtproduction$\scripts\invoke – Remove Builtin Apps.ps 1 : 76 : 21 + $OnDemandFeatures = Get – WindowsCapability -online | where-object {$_ …
    notspecified : (:) [get-windowsCapability]. ComException
    Do you know how to fix this one?

      • I have the same error message as Pierre. Any help would be appreciated. Mine was at Line 83:21

      • I got the error too.
        Fresh installed blank Windows 10 1709 Enterprise. When I want to run the script, the error appears. He has problems to execute this: “Get-WindowsCapability -Online”

      • Hello Nickolaj,
        the script was working well, its start showing this error lately. it’s deploy in the state and restore custom task as told. I think it try to remove an apps that can’t be remove, something in a last updates. This message appear in the MDT report windows at the end of the deployment. It look like the job is done anyway and most apps are remove. Just trying to find out how to get rid of this message. We are deploying Windows 10 enterprise 1709
        thanks

      • Hi Nick,
        I am running it after Pre-provision BitLocker – I have disable CloudContent by the following registry key and run remove Built-in apps package AppsRemoval.ps1. Can you please advise when you have a chance? Much appreciate your help.
        Thanks,

      • Hi Nickolaj
        I am seeing the exact same error. It’s something to do with the Get-WindowsCapability cmdlet, but I cannot get to the bottom of it.
        Regards
        Conor

      • Hey Conor,
        I’ve investigated this a bit, since I hit the same error in my environment when running with WSUS/SUP. It seems that the workaround would be to use dism.exe with /LimitAccess. In 1709 the Get-WindowsCapability cmdlet doesn’t have this as a switch/parameter, however it does in 1803. So the script has been updated for 1803 to support this new parameter, so that it doesn’t check for capabilities from Windows Update.
        Regards,
        Nickolaj

    • I Am getting the same error also. I notice I don’t get it on VM (It works great on VM) but when I run it on physical hardware I get the error. I was thinking it could be different PowerShell versions, but no. I did follow the link in the error but didn’t find it useful to solve the problem.
      I have put the BDD log file at (public access)
      https://www.dropbox.com/s/zn6p11g2l6s8c9q/BDD.log?dl=0
      Any help would be super appreciated.
      Error:
      The source files could not be downloaded.
      Use the “source” option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see https://go.microsoft.com/fwlink/?LinkId=243077.
      TaskSequencePSHost 15/01/2018 11:01:37 AM 0 (0x0000)
      At D:\Deploy\Scripts\EC\Win10removeapps\Invoke-RemoveBuiltinAppsROTC2.ps1:71 char:21
      + $OnDemandFeatures = Get-WindowsCapability -Online | Where-Object { $_ …
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TaskSequencePSHost 15/01/2018 11:01:37 AM 0 (0x0000)
      NotSpecified: (:) [Get-WindowsCapability], COMException TaskSequencePSHost 15/01/2018 11:01:38 AM 0 (0x0000)

  • Hi Nick,
    Thanks for sharing this script, when i run it part of my task sequence I am getting the following error while reviewing the log:
    Get-AppxPackage : 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 At C:\_SMSTaskSequence\Packages\SGR000F4\AppsRemoval.ps1:26 char:17 + $AppArrayList = Get-AppxPackage -PackageTypeFilter Bundle -AllUsers | … + CategoryInfo : ObjectNotFound: (Get-AppxPackage:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
    At the end it will show process completed with exit code 0 but when login apps will come back.
    Can you please tell me what I am missing?
    Thanks

  • It looks like you forgot a comma after “Microsoft.StorePurchaseApp” within the $WhiteListedApps = @(

  • I’m currently using this with my client. I had the same issue as other with the “ContactSupport” causing Sysprep to fail. So, I removed the script from the Build and Capture and I’m going to run it during OSD in ConfigMgr.

    • Hi All,
      Yeah, so it seems that there’s issues with removing the ContactSupport app. Even though I’ve stated earlier that it should work, that is not the case with the most current versions of Windows 10. These apps change from version to version, and it’s always a good idea to test this out before you simply just run the script in your environment on production systems.
      When time permits, I’ll try to update the script for Windows 10 version 1709.
      Regards,
      Nickolaj

      • Nickolaj,
        Thanks for sharing the script.
        During a SCCM OSD TS with Windows 10 1703, I’ve found the Remove-WindowsCapability -online -name command does not work. I’ve switched to using DISM /Online /Remove-Capability /CapabilityName:. When I get a chance, I’ll test the original script with Windows 10 1709.
        I will also test using the script during an image capture as ideally that’s when unwanted apps and features should be removed rather than the TS.
        regards,
        steve

      • Hi Steve,
        That’s weird, cause it’s worked in my tests. I’d recommend that you remove the apps in the reference image, as it makes most sense.
        Regards,
        Nickolaj

      • Any word on the update for Windows 10 version 1709? Its been a while and the V2 on-demand stuff has changed. May need to use DISM with “/LimitAccess” as MDT uses WSUS and it can have issues getting the “Get-WindowsCapabilities -Online” when it can’t talk to the internet or have a bunch of extras added to WSUS which I don’t.

  • Ok, so an update to my comment above: Appears the script does not wipe on fullpackagename for some strange reason. After running OSD with script in SCCM task sequence I’m left with the AppX list above and things like Code Writer, Microsoft Sway, Network Test etc. Things I cannot wipe with Remove-Appx (0x80073CFA) but things that wipe fine using Remove-AppX

  • Hi, what is the current status on this script on 1703? I’ve been working with this script the last days but I still end up with the list below on Get-AppxPackage – along with much other stuff I’d love to remove (Sway, Code Writer, Alarm and Clock, Connect, Get Help, Power BI, Network Test, Mixed Reality Portal, not able to disable Welcome Animations, App suggestions suggesting I install Karaoke(!) on a business computer.
    At this point I don’t see how I can successfully deploy this OS to 60+ y.o. computer novice users-
    Someone in MS must be on crack adding all this BS to an _Enterprise_ Edition. Along with the impossible apps to remove it appears the XML approach to assign file extensions doesn’t work anymore? My test-VM just said Edge snagged .PDF back :S
    This is really getting quite tiering and I’m very fed up of days of work simply trying to get a clean business OS. So any updated approach or ideas on the apps I mention here would be much, much appreciated. In advance, thank you.
    Get-AppxPackage results:
    46928bounde.EclipseManager
    AdobeSystemsIncorporated.AdobePhotoshopExpress
    D5EA27B7.Duolingo-LearnLanguagesforFree
    Microsoft.BingNews
    Microsoft.BingWeather
    Microsoft.MSPaint
    Microsoft.StorePurchaseApp
    Microsoft.Windows.Photos
    Microsoft.WindowsAlarms
    Microsoft.WindowsCalculator
    Microsoft.WindowsStore

  • this seems perfect for what i am required to do, How do i actually download the script though?
    thanks

  • I’m having to use SCCM as opposed to MDT for deployment and I have added this setup in a similar fashion as you have it here in your example images, yet still the bloat remains. Any considerations there that I may take to get this working?

  • I cannot get this to work for all profiles on either 1607 or 1703 they are removed for the admin account but any other user profile just has a bunch of broken apps listed under Other

  • also receiving Object not set errors but works great otherwise. Would love to hear how to eliminate those errors altogether so MDT doesn’t report errors everytime

    • Would it be better to remove those apps in post install phase? Or is there a reason why you are doing it while full os is already running?

  • I used your script as instructed in MDT for Win 1607 and my Deployment Summary has a list of “Object reference not set to an instance of an object”. When I look at the log I see no errors. It did work as expected but would like to eliminate the errors.

  • Hello, how to whitelist all under Windows Accessories folder? Some of these apps are still present if you search for them, however, the script knocks them off of the default list.

  • Hey,
    Awesome script!! I was wondering how to make this apply to all new profiles created? This seems to only work on the profile deployed on, which for me is the admin account.
    Thanks,
    Mark.D

  • @ Mark. This is a known issue when removing apps pre-sysprep. I run this script in MDT/SCCM after the OS is deployed in a task sequence. Hope this helps

  • Very nice script and I particularly like the white list idea as it makes for a straight forward way to customise the script. I have been testing this on the latest Windows 10 x64 Education v1703 wim as suggested this script is called during the State Restore of the reference build and everything appears to as expected.
    # White list of appx packages to keep installed
    $WhiteListedApps = @(
    “Microsoft.MicrosoftStickyNotes”,
    “Microsoft.MSPaint”,
    “Microsoft.Windows.Photos”
    “Microsoft.WindowsCalculator”,
    “Microsoft.WindowsStore”
    )
    $WhiteListOnDemand = “NetFX3|Tools.Graphics.DirectX|Tools.DeveloperMode.Core|Language|Browser.InternetExplorer|Media.WindowsMediaPlayer”
    Unfortunately the sysprep and capture fails and the C:\windows\system32\sysprep\panther\setupact.log identifies the Package Windows .ContactSupport_10.0.15063.0_neutral_neutral_cw5n1h2txyewy as the error.
    I have implemented the Windows Store Update as documented here, https://deploymentresearch.com/Research/Post/615/Fixing-why-Sysprep-fails-in-Windows-10-due-to-Windows-Store-updates
    Your script log shows that the features App.Support.ContactSupport~~~~0.0.1.0 & App.Support.QuickAssist~~~~0.0.1.0 have been removed and this is maybe true as there is no option to uninstall from the Apps & Features GUI.
    I am unable to remove the application using the PowerShell, Remove-AppxPackage Windows .ContactSupport_10.0.15063.0_neutral_neutral_cw5n1h2txyewy as it claims this app is part of Windows and cannot be uninstalled on a per-user basis. An Administrator can attempt to remove the app from the computer using Turn Windows Features on or off.
    Just hoping you could offer an insight and possible workaround so that full automation can be achieved.

  • Hi there, great script but it remove MS Paint and IE 11. How can we white list this?

    • $WhiteListedApps = @(
      “Microsoft.MSPaint”
      $WhiteListOnDemand = “NetFX3|Tools.Graphics.DirectX|Tools.DeveloperMode.Core|Language|Browser.InternetExplorer|Media.WindowsMediaPlayer”

      • That’s very useful. How would you remove Mixed Reality Portal? I can uninstall it but it still appears on the start menu

      • That mixed reality things is nice, but not always. Really annoying piece of software when you really don’t need it. So I went a little mad and did the following things:
        I ran a SQLite-browser as SYSTEM. Lookup the right row (ID: 3201 for me in build 16188) in the “Package” table, change the IsInbox to 0 on the row for the “Microsoft.Windows.HolographicFirstRun”-package in the “StateRepository-Machine.srd” file. You’ll find the file in C:\ProgramData\Microsoft\Windows\AppRepository .
        After that it was no problem running the command in PowerShell:
        Get-AppxPackage -Name ‘Microsoft.Windows.HolographicFirstRun’ | Remove-AppxPackage
        Don’t know the impact it will have on the system, if any. My system is still running fine 🙂

  • I was using your script with 1607 with great success but am having problems in 1703. In MDT we have added IE11 but the script removes it. The log file shows: “Starting Features on Demand V2 Removal and then removes Browser.InternetExplorer~~~~0.0.11.0. I’ve tried to white lists it in the script but still have the issue.

    • For Windows 10 1703 I uses this line:
      $WhiteListOnDemand = “NetFX3|Tools.Graphics.DirectX|Tools.DeveloperMode.Core|Language|Browser.InternetExplorer|Media.WindowsMediaPlayer”
      After Windows 10 1703 installation was finished Internet Explorer and Windows Media Player are still present.

      • I used this to fix the IE missing issue but for some reason it still moved Media Player for me, any ideas?

  • I tried this by adding to my Windows 10 1703 reference image. After I deploy the reference image, the first user that logs on (with a new profile) has dead tiles (“e.g. P~microsoft…”). They go away after a reboot, but is there any way to prevent that from happening in the first place?

    • Same here, did you find a fix? I have tried numerous ways of modifying the DefaultLayouts.xml file and I can get the dead tiles from showing but then it defaults to showing Settings, Store and Edge. I just want a blank area with no tiles

  • This works great, except for one thing I ran into – it removes (?)/disables Internet Explorer. Is there a way to add that to the White List, if so, how? Thank you!

    • Sure. Just add Browser.InternetExplorer to the $WhiteListOnDemand variable and you are good to go 🙂
      Example:
      $WhiteListOnDemand = “NetFX3|Tools.Graphics.DirectX|Tools.DeveloperMode.Core|Language|Browser.InternetExplorer”

      • Unfortunately I already ran this script and deployed to users, with Internet Explorer being removed :(. Our clients are impatient and want everything done yesterday. Is there a way to deploy internet explorer back to the users?

      • I ran the slightly older script that kills off internet explorer 11

      • I made this mistake too. Did you find a solution to re-deploying?

  • Why bother? Any apps you remove for all users will just get reinstalled during the next Windows 10 update – ie 1607 -> 1703.

    • Hi Pete, you can run the script during the post processing step in your In-Place Upgrade task sequence so that the apps are still removed. And once RS3 hits the market, you won’t have to do that anymore.
      Regards,
      Nickolaj

  • I would like disable windows Store , Any help ? Also when I’m trying to open the some apps on windows 10, like Edge it saying ” Microsoft Edge can’t be Opened using Built-in administartor account,Sign in with a different accunt and try” ..what exaclty it means , DO i need set up UAC control using GPO for this issue ?

  • Hi,
    How to Exclude the StickyNotes, windows 10 Photo viewer . this are the usefull apps and getting removed.

  • Very helpful script!
    On my Win10 1607 systems there are multiple flavors of many apps. For example:
    Microsoft.SkypeApp_11.12.112.0_neutral_~_kzf8qxf38zg5c
    Microsoft.SkypeApp_11.12.112.0_x64__kzf8qxf38zg5c
    Microsoft.SkypeApp_11.12.112.0_neutral_split.scale-100_kzf8qxf38zg5c
    I am curious as to why you used ‘-PackageTypeFilter Bundle’ as opposed to ‘Main, Framework’ (the default) or even ‘Main, Framework, Resource, Bundle’ and supplying a longer filter list?
    Specifying the entire filter list eliminates all variations of each app.
    Thank you,
    David

    • Hi David,
      No particular reason, you can customize it exactly how you want. There’s no script that fits all possible scenarios. Great comment though, I should have made a note of that in the post.
      Regards,
      Nickolaj

  • This is increditastical! One question, why define the array $WhiteListedApps internally rather than using a separate file and Get-Content ?

  • Hi Nickolaj,
    Great script. It has shown me how to remove Apps that I was previously stumped on because appear as “WindowsCapabilities”.
    Unfortunately I believe the script is causing my sysprep to fail at the end of my build and capture:
    SYSPRP Failed to remove staged package Windows.ContactSupport_10.0.14393.0_neutral_neutral_cw5n1h2txyewy:0x80070002.
    SYSPRP Failed to remove apps for the current user: 0x80070002.
    Have you encountered this type of problem?

  • Hi Nickolaj,
    thank you very much for providing your script.
    i tried it out in my environment and I don’t know why, but it does not remove any apps on my systems.
    I run the script as administrator and the log file is filled with removing application package – messages but when I run
    PS C:\WINDOWS\system32> Get-AppxPackage -PackageTypeFilter Bundle -AllUsers | Select-Object -Property Name, PackageFullName | Sort-Object -Property Name
    i see the following list of Apps, and the apps are still present in start menu:
    Name PackageFullName
    —- —————
    Microsoft.3DBuilder Microsoft.3DBuilder_12.0.3131.0_neutral_~_8wekyb3d8bbwe
    Microsoft.BingWeather Microsoft.BingWeather_4.18.52.0_neutral_~_8wekyb3d8bbwe
    Microsoft.DesktopAppInstaller Microsoft.DesktopAppInstaller_1.2.2002.0_neutral_~_8wekyb3d8bbwe
    Microsoft.Getstarted Microsoft.Getstarted_4.5.6.0_neutral_~_8wekyb3d8bbwe
    Microsoft.Messaging Microsoft.Messaging_2.7.1001.0_neutral_~_8wekyb3d8bbwe
    Microsoft.MicrosoftOfficeHub Microsoft.MicrosoftOfficeHub_2017.318.204.0_neutral_~_8wekyb3d8bbwe
    Microsoft.MicrosoftSolitaireCollection Microsoft.MicrosoftSolitaireCollection_3.15.3072.0_neutral_~_8wekyb3d8bbwe
    Microsoft.MicrosoftStickyNotes Microsoft.MicrosoftStickyNotes_1.7.1.0_neutral_~_8wekyb3d8bbwe
    Microsoft.Office.OneNote Microsoft.Office.OneNote_2015.7967.57661.0_neutral_~_8wekyb3d8bbwe
    Microsoft.OneConnect Microsoft.OneConnect_1.1607.6.0_neutral_~_8wekyb3d8bbwe
    Microsoft.People Microsoft.People_2017.212.1701.0_neutral_~_8wekyb3d8bbwe
    Microsoft.SkypeApp Microsoft.SkypeApp_11.12.112.0_neutral_~_kzf8qxf38zg5c
    Microsoft.StorePurchaseApp Microsoft.StorePurchaseApp_11608.1000.24314.0_neutral_~_8wekyb3d8bbwe
    Microsoft.Windows.Photos Microsoft.Windows.Photos_2017.214.10010.0_neutral_~_8wekyb3d8bbwe
    Microsoft.WindowsAlarms Microsoft.WindowsAlarms_2017.301.1832.0_neutral_~_8wekyb3d8bbwe
    Microsoft.WindowsCalculator Microsoft.WindowsCalculator_2017.301.1149.0_neutral_~_8wekyb3d8bbwe
    Microsoft.WindowsCamera Microsoft.WindowsCamera_2017.125.40.0_neutral_~_8wekyb3d8bbwe
    microsoft.windowscommunicationsapps microsoft.windowscommunicationsapps_2015.8021.42017.0_neutral_~_8wekyb3d8bbwe
    Microsoft.WindowsFeedbackHub Microsoft.WindowsFeedbackHub_1.1702.653.0_neutral_~_8wekyb3d8bbwe
    Microsoft.WindowsMaps Microsoft.WindowsMaps_2017.317.1503.0_neutral_~_8wekyb3d8bbwe
    Microsoft.WindowsSoundRecorder Microsoft.WindowsSoundRecorder_2017.301.1209.0_neutral_~_8wekyb3d8bbwe
    Microsoft.WindowsStore Microsoft.WindowsStore_11701.1001.794.0_neutral_~_8wekyb3d8bbwe
    Microsoft.XboxApp Microsoft.XboxApp_2017.317.244.0_neutral_~_8wekyb3d8bbwe
    Microsoft.XboxIdentityProvider Microsoft.XboxIdentityProvider_2016.719.1035.0_neutral_~_8wekyb3d8bbwe
    Microsoft.ZuneMusic Microsoft.ZuneMusic_2019.17022.10301.0_neutral_~_8wekyb3d8bbwe
    Microsoft.ZuneVideo Microsoft.ZuneVideo_2019.17022.10311.0_neutral_~_8wekyb3d8bbwe
    Do you have any hints?
    Thanks,
    Markus

    • Hi Markus,
      I ran the updated scripts on a couple of lab Windows 10 1607 machines and the apps were removed, even without a reboot. Could you provide some more information that might be helpful regarding your environment?
      Regards,
      Nickolaj

  • Hello,
    The script works, but throws back some errors at the end of an MDT task sequence.
    The majority of the errors are “Object not set…” and there will be about 20 of these in a row. Is there a way to silence these errors?
    Thanks,
    Jordan

  • Is this suppose to remove all Apps except the exception ones?
    I am still left with Microsoft.WindowsAlarms, Microsoft.People, Microsoft.Office.OneNote and more on 1607.

  • Is this script intended to be added for the capture task sequence or for the deploy? Thanks

    • You can add it where you think it fits in your environment. I’m mostly using it when capturing images.
      Regards,
      Nickolaj

      • Ok so that’s what is confusing me. So by adding it into the capture task you are then preventing it to come again at the deploy task? Or you are actually adding it at both tasks to play safe?
        On the other hand, I have been using the script for deploy (added at the same phase level as you (so within custom tasks and before Enable Bitlocker) but it doesn’t work for me. My monitoring console does mark the deploy as 100% completed but in my test VM it stucks at the big blue screen “just wait a little bit more / configuring app”. I have to reboot it to get access to the deployed VM and when I check all built-in apps are still there.
        Any hints or ideas?
        Thank you !!

  • Thank you so much for this post worked perfectly for us. Deployed this in SCCM a little different than posted.
    1. Create folder in our apps share and placed the PS script there.
    2. Create a Package, make sure you select “Do Not Create a Program”.
    3. Add a Task – “Run PowerShell Script”, Point to package, Script name, PowerShell execution Policy to “Bypass”.

  • Have you experienced any problems when language packs are applied?
    Whenever i add any kind of removal script, the translation of the computers settings get’s messed up.

  • This script was working great for us, but after a few updates it seems to be less effective. Not sure what is going on, so I am thinking it would be handy to have some sort of log output.
    I am hoping you can either modify your script to output a log, or maybe provide some direction on doing so our selves?

  • Would this also work in Windows 8.1 for removing the build-in Metro apps? If no would it be possible for you to make it compatible with Windows 8.1 too?
    Would be much appreciated!
    Best regards!

  • […] Hi Guys Going to create a new reference image for windows 10 1607 but before i start i would like to remove the default apps via powershell using SCCM and a task sequence but dont know where to add it or how, had a look at the following guide but my task looks nothing like that. Any idea's? Remove Built-in apps when creating a Windows 10 reference image | System Center ConfigMgr […]

  • Does this script work offline?
    I got this to work online (during the state restore phase) but will not work during the post-install phase.

  • Any way to get further information for each built-in application? Looking for specifically which each application is so we can make a meaningful decision to leave in or take out of the image.

  • Thanks for updating this post. Do you happen to know what the each of the new built-in apps in v1607 do?
    I’m guessing DesktopAppInstaller is for the upcoming feature allowing win32 apps to be installed from the store, which is definitely one to keep.
    I thought that Messaging is the SMS app for mobile and for text messaging on a PC when paired with a windows mobile or android device. Do I have that wrong, or is there a reason that you consider this an essential app?
    What about StorePurchaseApp, which I see that you kept, and OneConnect, which you didn’t? Any idea what either of these do?

  • Hi & let me say THX for incredible forum at the beginning. My issue is that I tried already several options how to remove Appx from Windows 10 x64, x86 Enterprise Edt. nevertheless all new users has installed apps like CandyCrash, XBox,.. :(. Can you give me an advice where this step should be exactly situated within SCCM Task Sequence to make it working please? The same issue I am dealing with setup StartMenu modification & language settings & I hope that with some advice I will be able to solve all. Thank you in advance.

  • Hi
    i can’t get this to work. Deployment log returns: “TSHOST: Script completed with return code 0 TaskSequencePSHost 2016-06-21 16:07:59 0 (0x0000)
    ” it does not remove any app at all. In task sequense it runs before pre win update.

  • Congratulations for your amazing script, however I have a doubt. How can I remove the apps for all users? Even if it’s a new user. Because when I deployed the captured image whit your script on the TS, I logged in for the first time on the VM with the captured image but the apps still there. I tried your script on the current user and it works like a charm, but when I change user, the apps still there for the new user.
    Best Regards.

  • I’ve been removing “windowscommunicationsapps”. Is that really an essential app? We don’t use Calendar, Mail, or Contacts/People, so I figured it wasn’t needed. I hope it doesn’t break anything.

    • A reply to this would be helpful. It seems “essential app” term may be a more general statement than an actual requirement. I too am not using Mail, Contacts, People, or Messaging, so I don’t see why the “microsoft.communicationsapps” would be needed. I am thinking he needed it because he was keeping Messaging.
      Explanations as to why each is “needed” or “essential” would be helpful. And clarification as to whether “essential” means to the functioning of Windows or to the apps you have selected.

  • just execute it as a TS step for run command line..
    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -file .\script.ps1
    make sure you specify a source for script

  • Hi Nickolaj, Thank you for one more nice script.
    I have a question, I have already my Gold image built, I normally remove those apps using DISM offline, which takes some time to mount image, perform the actions, unmount, etc.
    So I was wondering, Can I use this script on my ConfigMgr 2012 Task Sequence?
    If so, how should I proceed?
    I believe I would need to create a package (no program) using this script, right?
    At which step should I add this script to on my TS?
    Thank you in advance.
    Eden

Sponsors