Search code examples
powershellpowershell-3.0

Powershell: Two questions about Get-AppxPackage and the -PackageTypeFilter parameter


I am making a list of app packages installed on my system. In this specific case the ZuneMusic packages. I use the following command:

Get-AppxPackage -AllUsers -PackageTypeFilter Main, Bundle, Resource, Framework  | 
                 Where-Object {$_.Name -like "*ZuneMusic*"} 

This will get me a list/result with 4 packages. I can see some have IsResourcePackage : True and one has IsBundle : True etc. It seems this has to do with the -PackageTypeFilter cause if I only use Main is get only one result. I Looked up the parameter -PackageTypeFilter description:

Specifies one or more comma-separated types of packages that the cmdlet gets from the package repository. Valid values are: Bundle Framework Main Resource None

  1. Can someone elaborate/explain a bit more what this -PackageTypeFilter parameter does please?

  2. If I want to delete packages of apps that I do not use or want. Do I use all options of this parameter and delete all the results or is one specific option enough?


Solution

  • why dont you just do get-appxpackage -name *zunemusic* -allusers | remove-appxpackage?

    1. dont use -packagetypefilter
    2. the pipeline will get all the returned apps named *zunemusic* and remove them - however, if it floats your boat, specify each package individually

    if you remove each package individually, possible future name changes could affect the script and will require manual update if so - probably unlikely though