-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
28 lines (23 loc) · 1.02 KB
/
Program.cs
File metadata and controls
28 lines (23 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using Windows.ApplicationModel;
using Windows.Management.Deployment;
void GetManagementPackages()
{
var mgr = new PackageManager();
var pkgs = mgr.FindPackagesForUser(""); // current user
//var pkgs = mgr.FindPackages(); // require admin privileges
// filter out system packages (not shown in "Apps & features")
pkgs = pkgs.Where(_ => _.SignatureKind != PackageSignatureKind.System).ToList();
// filter out frameworks (not shown in "Apps & features")
pkgs = pkgs.Where(_ => _.IsFramework == false).ToList();
Console.WriteLine($"Found {pkgs.Count()} packages.");
foreach (Package pkg in pkgs)
{
Console.WriteLine("Package info:");
Console.WriteLine(" DisplayName: "+pkg.DisplayName);
Console.WriteLine(" Id: " + pkg.Id.FullName);
PackageVersion ver = pkg.Id.Version;
Console.WriteLine($" Version: {ver.Major}.{ver.Minor}.{ver.Build}.{ver.Revision}");
Console.WriteLine(" InstalledDate: " + pkg.InstalledDate);
}
}
GetManagementPackages();