如何使用C#在Windows中获取系统安装的应用程序? [英] How to get system installed apps in windows using C# ?

查看:356
本文介绍了如何使用C#在Windows中获取系统安装的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个简单的C#应用​​程序,我将获得系统安装的应用程序数量。不是用户安装的应用程序。

经过一番研究,我发现我们可以使用注册表类但我不知道如何使用此类来得到我想要的信息。



我尝试过:



我试图找到它,但每个人都在谈论用户安装的应用程序。

喜欢此处此处

I'm working on a simple C# Application, where I've to get the number of system installed apps. Not the applications installed by the user.
After some working on this, I came to know we can get information of system resources using Registry Class but I don't know how can I use this class to get my desired info.

What I have tried:

I tried to find it but everyone is talking about the application installed by the user.
like here and here.

推荐答案

这里的实际问题是,如何判断用户或系统(包括IT部门等)安装了应用程序。 )。要使用注册表并找到已安装的所有应用,您已经检查过此 SO thread 。但同样,使用.NET Core完成UWP运行时可以轻松完成的任务的目的是什么 - PackageManager [ ^ ]对象?通过此API,可以非常轻松地查看安装应用程序的用户,来自a href =https://docs.microsoft.com/en-us/uwp/api/windows.management.deployment.packageuserinformation的备注部分> PackageUserInformation [ ^ ],

The actual question here is, how to tell that an app is installed by user or System (including the IT department, etc. etc.). To use the Registry and find all the apps installed you have already checked this SO thread. But again, what is the purpose of using .NET Core for a task that can be done easily by UWP runtime — PackageManager[^] object in Windows Runtime? This API makes it super easy to check who installed the app, from the Remarks section at, PackageUserInformation[^],
Quote:

要枚举已安装软件包的用户,请使用 PackageManager.FindUsers [ ^ ]方法。

To enumerate the users who have installed a package, use the PackageManager.FindUsers[^] method.

然后你可以查看安装的人它。



如果你仍然想使用.NET Core,那么你可能想要使用一种解决方法,一种方法来告诉谁安装了应用程序是检查Windows日志和事件,看看发生了什么,以及谁的帐户。最后的方法是 - 可能是 - 检查安装的每个应用程序的可执行文件,并查看谁创建了应用程序,这要求您启用文件的审核,请检查此Windows Server相关的线程; 4.18。查找上次打开或修改过的文件 - Windows Server Cookbook [书籍] [ ^ ]



我仍​​然不知道你能用什么方式告诉本机而且没有任何方法修改系统,谁做了什么。

And you can then check who installed it.

If you still want to use .NET Core, then you might want to use a workaround, one way to tell who installed the app is to check the Windows logs and events to see what happened and with whose account. Last approach will be — might be — to check the executable files for each of the app installed, and see who created the app and this requires that you enable auditing of the files, please check this Windows Server related thread; 4.18. Finding Who Last Opened or Modified a File - Windows Server Cookbook [Book][^]

Still I am unaware of any way that you can tell natively and without any modifications to the system, who did what.


这篇关于如何使用C#在Windows中获取系统安装的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆