3

I'm trying to replicate the functionality of the Get-AppxPackage and Get-ProvisionedAppxPackage Powershell cmdlets for a C# application I'm building, but have no idea how to even get started.

I can't use the C# Powershell API because of this problem, so I'd like a native C# solution if possible.

Community
  • 1
  • 1
8bitcartridge
  • 1,629
  • 6
  • 25
  • 38

2 Answers2

3

You can use the Windows.Management.Deployement.PackageManager to find, remove, install, etc. packages from code rather than from PowerShell.

The Enumerate app packages sample demonstrates how to use this from C# and C++.

Rob Caplan - MSFT
  • 21,714
  • 3
  • 32
  • 54
2

For what it's worth, I did find a way to get this information directly from WMI: There's a WMI class called Win32_InstalledStoreProgram that returns the desired information

8bitcartridge
  • 1,629
  • 6
  • 25
  • 38