Removing Windows 8 / 8.1 Metro APPS with Powershell
I know I said in the other article the powershell wasn't really required for this task, but i'm allowed to change my mind. There are a couple of advantages to doing it with powershell.
First it's important to note that provisioned apps are available for all users, when a new account logs in the first time all provisioned apps on the system are installed for that user. So when we are uninstalling them there are 2 things that need to happen, 1 uninstall it for any user who may have logged in probably just administrator, and 2 UN-Provision the apps so they won't install for new users. The script below is a great way of doing it with powershell. Save it as removeappx.ps1 or some such thing...then add to you task sequence as an application.
I have tested this now...it works fine....then i added a progress bar. It runs without errors so should still work fine but i'm not sure how the progress bar is going to work out. I don't have a windows 8 machine to test it on at the moment.
----------------------start cut---------------------------------------------------------------
# uninstall all metro apps for current user and then unprovision all provisoined apps for Windows 8 or 8.1
$ProvisionedPackages = Get-AppxProvisionedPackage -online
$Packages = Get-AppxPackage
$Apps ="Microsoft.Bing", "microsoft.windowscommunicationsapps","Microsoft.BingFinance","Microsoft.BingMaps","Microsoft.BingWeather","Microsoft.ZuneVideo","Microsoft.ZuneMusic","Microsoft.Media.PlayReadyClient.2","Microsoft.Media.PlayReadyClient.2","Microsoft.XboxLIVEGames","Microsoft.HelpAndTips","Microsoft.BingSports","Microsoft.BingNews","Microsoft.BingFoodAndDrink","Microsoft.BingTravel","Microsoft.WindowsReadingList","Microsoft.BingHealthAndFitness","Microsoft.WindowsAlarms","Microsoft.Reader","Microsoft.WindowsCalculator","Microsoft.WindowsScan","Microsoft.WindowsSoundRecorder","Microsoft.SkypeApp"
$i = 0
ForEach($Pack in $packages)
{
$i++
if($Apps -contains $Pack.name )
{
Write-Progress -Activity "Uninstalling apps" -status "Removing: $Pack.name" -percentComplete ($i / $packages.count*100)
Remove-AppxPackage -package $Pack.PackageFullName
}
else
{Write-Progress -Activity "Uninstalling apps" -status "$Pack.name not in app list" -percentComplete ($i / $packages.count*100)}
}
$i=0
ForEach ($package in $ProvisionedPackages)
{
if($Apps -contains $package.displayName )
{
$i++
Write-Progress -Activity "Unprovisoning apps" -status "Removing: $package.displayName" -percentComplete ($i / $ProvisionedPackages.count*100)
remove-AppxProvisionedPackage -online -packagename $package.PackageName
}
else
{Write-Progress -Activity "Unprovisioning apps" -status "$Pack.name not in app list" -percentComplete ($i / $packages.count*100)}
}
-----------------------------------------end cut ----------------------------------------------