Home > Enterprise >  List AppxPackages by IsFramework = True
List AppxPackages by IsFramework = True

Time:11-05

I'm working on a PowerShell script that automates AppxPackages uninstallation.

When we type this command: Get-AppxPackage, we get a result like this:

PS C:\> Get-AppxPackage

Name              : Microsoft.NET.Native.Framework.1.6
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 1.6.24903.0
PackageFullName   : Microsoft.NET.Native.Framework.1.6_1.6.24903.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.NET.Native.Framework.1.6_1.6.24903.0_x64__8wekyb3d8bbwe
IsFramework       : True
PackageFamilyName : Microsoft.NET.Native.Framework.1.6_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

#And many more...

Look at IsFramework. I want to list all IsFramework = True AppxPackages.

Right now, I have this code: Get-AppxPackage | Select Name, IsFramework

It lists ALL AppxPackages, and I want to list ONLY IsFramework = True AppxPackages.

CodePudding user response:

This can be easily accomplished by the use of Where-Object to filter the resulting array:

Get-AppxPackage | Where-Object IsFramework

As opposed, if you wanted to filter where IsFramework is $false:

Get-AppxPackage | Where-Object IsFramework -EQ $false

Note that, here we're using Comparison statement, if you wanted to combine this expression with your previous question (filtering also, by those Apps not in $WhitelistedApps) you would need to filter using a Script block:

Get-AppxPackage | Where-Object { $_.IsFramework -and $_.Name -notin $WhitelistedApps }
  • Related