如何使用c#从系统禁用特定应用程序 [英] How to disable a particular application from the system using c#

查看:108
本文介绍了如何使用c#从系统禁用特定应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用c#

推荐答案

从我们的系统禁用特定安装的应用程序我不认为存在禁用应用程序这样的概念。可以安装和卸载应用程序。



如果您真的需要,可以通过设置文件权限来阻止对应用程序的访问,例如,对于应用程序所在的目录已安装。



此CodeProject文章中解释了代码功能,如何获取已安装应用程序的列表,以及每个此类应用程序的所有基本属性:使用C#获取系统的已安装应用程序列表 [< a href =http://www.codeproject.com/Tips/782919/Get-List-of-Installed-Applications-of-System-inCstarget =_ blanktitle =New Window> ^ ]。



但是,我怀疑你能顺利解决问题。首先,没有一种可靠的方法可以找到所有.lnk文件,这些文件可以放在菜单,桌面,堆栈栏的不同位置(请记住,这些容器对于不同的用户是不同的),只是在文件系统中,除非你扫描系统上的所有磁盘。这是因为任何人都可以随时复制任何.lnk文件或创建新文件。即使您只执行一次,任何用户都可能在重新启用应用程序时添加新的.lnk,因此,如果您创建并维护现有.lnk文件的某种注册表,那么它实际上是无用的,因为用户可以在对文件的访问可用时随时删除或添加任何文件。而且,对于最终用户,对应用程序的访问主要通过.lnk文件完成。如果禁止访问应用程序文件,指向应用程序的.lnk文件将变为无效,这将使用户感到困惑。



此外,还有许多应用程序根本没有安装。 (对我而言,它们很有意义;在许多情况下,这种方法是最好的。)



无论如何,您可以根据许可实施此类应用程序。要使用文件权限,请参阅:

https://msdn.microsoft.com/en-us/library/system.security.permissions%28v=vs.110%29.aspx [ ^ ],

另见 https://msdn.microsoft.com/en-us/library/bb727008 .aspx [ ^ ] 。



现在你已经拥有了开发应用程序的一切,该应用程序管理对已安装应用程序的访问控制,并支持一组启用和禁用的应用程序。



也许,我错在这里,因为我不太了解你的目标,但我怀疑这样的应用是否真的需要。用户更了解使用什么和不使用什么。这是一个企业文化(可以,政策),不合格和做标准的日常运营员工需要戴上手铐吗?只需通过固定的应用程序集提供标准系统设置,并通过创建专门的用户组为不同类别的工作人员提供不同的权限。



-SA
I don't think there is such concept as "disabled application". The application can be installed and uninstalled.

If you really want, you can block the access to the application by setting file permissions, say, for the directory where the application is installed.

The code functionality is explained in this CodeProject article, how to get the list of installed application, with all essential attributes of each such application: Get List of Installed Applications of System in C#[^].

However, I doubt you can solve the problem smoothly. First of all, there is no a reliable method of finding all .lnk files which could be placed on different place of menu, desktop, stack bar (remember, these containers are different for different users) and just in file system, unless you scan all disks on the system. This is because anyone is free to copy any .lnk file or create a new one at any moment. And even if you do it once, any user may add a new .lnk when you re-enable the application, so, if you create and maintain a kind of registry of existing .lnk file, it would be practically useless, because a user can delete or add any of them at any time when the access to the file is available. And, for a final user, the access to the application is mostly done via a .lnk file. If you prohibit access to the application file(s), the .lnk file pointing to the application becomes invalid, which would be confusing to the user.

Besides, there are many applications which don't have installation at all. (To me, they make a lot of sense; and this approach is the best in many cases.)

Anyway, you can implement such application based on permission. To work with file permissions, please see:
https://msdn.microsoft.com/en-us/library/system.security.permissions%28v=vs.110%29.aspx[^],
see also https://msdn.microsoft.com/en-us/library/bb727008.aspx[^].

Now you have everything to develop the application which administer access control to the installed application and supports the set of enabled and disabled applications.

Maybe, I wrong here, because I am not well aware of your goals, but I doubt that such application is really needed. The user knows better what to use and what not. Is it a corporate "culture" (all right, policy) where non-qualified and doing standard routine operations associates needs to be in handcuffs? Just provide standard system setup with fixed set of application and give different categories of workers different permission, by creating specialized user groups.

—SA


我认为可以接受的方法是修改用户的组策略(参见 this [ ^ ] article)。 要开始学习如何从C#应用程序更改组策略,请参阅 这个 [ ^ ] post。



/ ravi
I think the accepted way to do this is to modify the user's group policy (see this[^] article).  To begin to learn how to make changes to a group policy from a C# app, see this[^] post.

/ravi


how禁用和启用其他笔记本电脑的特定安装应用程序,这两台笔记本电脑都使用wifi,以及如何获取通知哪个应用程序当前在其他笔记本电脑中运行通过使用wifi连接

你可以为我提供任何解决方案或代码
how to disable and enable particular installed application of others laptop which is connected both are using wifi , and how to get notification which application currently in run in other laptop which connected though using wifi
can u provide me any solution or code


这篇关于如何使用c#从系统禁用特定应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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