PowerShell: Removing UWP apps from Windows 10 1607/1703

Update 03/08/2017: I’ve re-written much of this post to answer some questions that have come up and to help clarify the process. Thanks to Jörgen Nilsson over at ccmexec.com, with his original post that inspired me to write this one.

When deploying Windows 10 1607/1703 you might want to remove some of the included UWP apps to help speed up the log in process, save storage space, bandwidth etc. There’s a few different ways you can do this. This post will also cover how to remove UWP apps for the current logged on user.

 

Obtaining a List of UWP Apps

The best way to do this is to build a clean Windows 10 1607/1703 image and then run the following PowerShell command:

Get-AppxProvisionedPackage -Online | Select Displayname

This will display a list of all the apps currently provisioned – apps that will be installed for new users. Personally I don’t remove all of them for my images, but ultimately, it’s up to you and what’s right for your environment.

Here’s a list of the provisioned apps in Windows 10 1703 as of 03/08/2017:

DisplayName
-----------
Microsoft.3DBuilder
Microsoft.BingWeather
Microsoft.DesktopAppInstaller
Microsoft.Getstarted
Microsoft.Messaging
Microsoft.Microsoft3DViewer
Microsoft.MicrosoftOfficeHub
Microsoft.MicrosoftSolitaireCollection
Microsoft.MicrosoftStickyNotes
Microsoft.MSPaint
Microsoft.Office.OneNote
Microsoft.OneConnect
Microsoft.People
Microsoft.SkypeApp
Microsoft.StorePurchaseApp
Microsoft.Wallet
Microsoft.Windows.Photos
Microsoft.WindowsAlarms
Microsoft.WindowsCalculator
Microsoft.WindowsCamera
microsoft.windowscommunicationsapps
Microsoft.WindowsFeedbackHub
Microsoft.WindowsMaps
Microsoft.WindowsSoundRecorder
Microsoft.WindowsStore
Microsoft.XboxApp
Microsoft.XboxGameOverlay
Microsoft.XboxIdentityProvider
Microsoft.XboxSpeechToTextOverlay
Microsoft.ZuneMusic
Microsoft.ZuneVideo

To get a list of installed UWP apps for the current user, you should use this PowerShell command:

Get-AppxPackage | Select Name

 

Remove UWP Apps from the Current User

The script below will remove the apps specified at the top of the script from the currently logged on user’s profile. It will run without administrative privileges.

## Configure the apps to be removed
$AppsList = "Microsoft.3DBuilder",
            "Microsoft.BingWeather",
            "...",
            "Microsoft.ZuneVideo"

##Remove the Apps listed above or report if app not present
ForEach ($App in $AppsList)
{
    $PackageFullName = (Get-AppxPackage $App).PackageFullName

    If ($PackageFullName) {
        Write-Host "Removing Package: $App"
        Remove-AppxPackage -Package $PackageFullName
    }

    Else {
        Write-Host "Unable to find package: $App"
    }
}

## End

 

Remove Provisioned UWP Apps from Windows 10

The script below will remove the specified UWP apps that are provisioned in Windows 10 1703 eg. Groove Music, Photos, Mail and Calendar, etc. Please note that the Start Menu for new users will still have icons for the removed apps and they will need to be removed, either manually by the user or you can customise the Start Menu (as well as the Taskbar) using Group Policy. The script below must be run with administrative privileges.

## Configure the apps to be removed
$AppsList = "Microsoft.3DBuilder",
            "Microsoft.BingWeather",
            "...",
            "Microsoft.ZuneVideo"

##Remove the Apps listed above or report if app not present
ForEach ($App in $AppsList)
{
    $ProPackageFullName = (Get-AppxProvisionedPackage -Online | Where {$_.Displayname -eq $App}).PackageName

    If ($ProPackageFullName) {
        Write-Host "Removing Provisioned Package: $ProPackageFullName"
        Remove-AppxProvisionedPackage -Online -PackageName $ProPackageFullName
    }

    Else {
        Write-Verbose "Unable To Find Provisioned Package: $App"
    }
}

## End

 

Remove Provisioned UWP Apps from a Windows 10 .wim Image (Offline)

The script below will remove the specified UWP apps that are provisioned in a Windows 10 1703 .wim file. Please note that much like the above script the Start Menu for new users will still have icons for the removed apps and they will need to be removed, either manually by the user or you can customise the Start Menu (as well as the Taskbar) using Group Policy. The script below must be run with administrative privileges.

## Configure the location of your image and a path to mount it
$Wim = "E:\foo\myimage.wim"
$Index = "1"
$MountPath = "E:\foo\offline"

## Configure the apps to be removed
$AppsList = "Microsoft.3DBuilder",
            "Microsoft.BingWeather",
            "...",
            "Microsoft.ZuneVideo"

## Mount the Image
Mount-WindowsImage –ImagePath $Wim –Index $Index –Path $MountPath

##Remove the Apps listed above or report if app not present
ForEach ($App in $AppsList)
{ 
    $ProPackageFullName = (Get-AppxProvisionedPackage -Path $MountPath | Where {$_.Displayname -eq $App}).PackageName

    If ($ProPackageFullName) {
        Write-Host "Removing Provisioned Package: $ProPackageFullName"
        Remove-AppxProvisionedPackage -Path $MountPath -PackageName $ProPackageFullName
    }

    Else {
        Write-Host "Unable to find provisioned package: $App"
    }
}

## Dismount the image and save changes
Dismount-WindowsImage –Path $MountPath -Save

## End

 

The Original Script

For my environment, I use the script below as a part of a MDT Task Sequence that creates my reference image. The script below is pretty much the original with some edits by me for Windows 10 1703. It’s from Jörgen Nilsson’s post on his site, ccmexec.com. The script removes the apps specified from the local administrator account (which is what the MDT Task Sequence runs as) and removes the provisioned apps from the image. During the deployment Task Sequence, the StartMenu and Taskbar are customised for the local admin account to remove the icons for apps that are no longer installed, and I also use the CopyProfile option in the unattend.xml to set the local administrator’s profile as the default for all users. This works for a very locked down environment, but for a more open environment once of the scripts above as a log on script might suffice.

$AppsList = "Microsoft.3DBuilder",
            "Microsoft.BingWeather",
            "...",
            "Microsoft.ZuneVideo"

ForEach ($App in $AppsList) {
    $PackageFullName = (Get-AppxPackage $App).PackageFullName
    $ProPackageFullName = (Get-AppxProvisionedPackage -Online | Where {$_.Displayname -eq $App}).PackageName

    If ($PackageFullName) {
        Write-Verbose "Removing Package: $App"
        Remove-AppxPackage -Package $PackageFullName
    }

    Else {
        Write-Host "Unable To Find Package: $App"
    }

    If ($ProPackageFullName) {
        Write-Verbose "Removing Provisioned Package: $ProPackageFullName"
        Remove-AppxProvisionedPackage -Online -PackageName $ProPackageFullName
    }

    Else {
        Write-Verbose "Unable To Find Provisioned Package: $App"
    }
}

 

I hope you find this useful. If you’d like to get in touch with me please leave a comment or tweet me.

-Mike

Follow Mike on Twitter: @Digressive

10 thoughts on “PowerShell: Removing UWP apps from Windows 10 1607/1703

  1. Pingback: Building a Windows 10 1703 (Creators Update) Reference Image with Microsoft Deployment Toolkit | Stick To The Script!

  2. One large problem is the user this is run against has to have administrative rights to their PC. In an enterprise environment like ours, 99% of users are NOT. When you even run this as administrator, it uninstalls under that profile…not the user. From here on we’re pushing 1703 only through OSD in ConfigMgr. But we do have about 50 users that need to be upgraded. Any suggestions? Even Microsoft premier support is stuck on this one

    Like

    • What I do is run the Remove-Apps PS script during image creation in the Task Sequence. Then on deploy I use copy profile in the unattend.xml, so the default profile is free of the apps.

      Like

  3. Pingback: Walkthrough: Building a Windows 10 1703 (Creators Update) Reference Image with Microsoft Deployment Toolkit | Stick To The Script!

  4. Hi Mike,

    I’m setting up deploying Win10 v1607 with MDT and wondering where in the TS you could put this?

    Just an added note, I am adding CU KB4025339 in Preinstall area right after Inject drivers. I don’t create any hybrid images and simply use MDT to deploy the vanilla v1607 wim…..just a preference thing at the moment.

    Thanks

    Like

    • Hi Patrick, I’ve actually just updated this post to explain the process better. In my TS I put the remove-UWP-apps PowerShell script in a Custom Tasks folder after Windows Update (Post-Installation).

      Hope that helps.

      Like

  5. Hi,
    I found out an easy (?) way to clear the broken tiles that are left over after the store apps are removed and you log in as a different new user. Just run the following powershell command:
    Stop-Process -ProcessName explorer -Force
    You have to do this once per every new user that logs into the machine.

    “Luckily” in our situation this is already done by the manage taskbar script, explained here: http://ccmexec.com/2015/12/removing-the-edge-icon-from-the-taskbar-during-osd/
    Part of the script is the commandlet outlined above.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s