地址"访问被拒绝"异常WMI调用 [英] Addressing "Access Denied" Exception with WMI Calls

查看:161
本文介绍了地址"访问被拒绝"异常WMI调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了一个异常的消息对一个WMI请求执行时拒绝访问。 WMI的一些要求似乎需要比别人更高的安全权限。最终,我的目标是监控系统中的进程启动和登录。无论是否有更好的方法,它现在变成了深仇在得到这个WMI的工作方式。

I'm getting an exception with a message of "Access Denied" when executing against a WMI request. Some WMI requests appear to require higher security privileges than others. Ultimately my goal is to monitor process launches within the system and log. Regardless if there is a better approach, its now become a vendetta in getting this WMI approach to work.

我已经尝试了code处的安全工具 - >使用C#.NET ,仍然收到异常WMI编程。如果复制在博客条目中找到的code可以重现我的问题。

I've attempted the code at Security Tools -> WMI Programming Using C#.Net and still receive the exception. If you copy the code found in the blog entry you can reproduce my issue.

这是一个类似的话题又一部后,可以在<一个发现href="http://stackoverflow.com/questions/510372/how-to-monitor-process-program-execution-in-windows">link文字但同样,尝试code,你会看到在同一个安全异常。

Another post on a similar topic can be found at link text but again, try the code and you'll the see the same security exception.

我如何使我的code来执行这些WMI要求?

How do I permit my code to execute these WMI requests?

我在一个新的C#命令行项目上的Windows 7专业版和VS 2010上运行。

I'm running on Windows 7 Pro and VS 2010 in a new C# command line project.

编辑: 选择以管理员身份运行为VS2010实例,然后执行code ++工程。我如何自动执行此所以用户不必手动提升权限?

Choosing "Run As Administrator" for the VS2010 instance and then executing the code works. How do I automate this so a user doesn't have to manually elevate the privilege?

推荐答案

有些WMI的调用也需要管理员权限。你尝试右键单击您的.exe文件并选择以管理员身份运行?

Some of these WMI calls may need admin privileges. did you try right clicking your .exe file and selecting "Run As Administrator"?

添加一个清单您的程序,以便它总是与运行管理员权限。 <一href="http://bartdesmet.net/blogs/bart/archive/2006/10/28/Windows-Vista-_2D00_-Demand-UAC-elevation-for-an-application-by-adding-a-manifest-using-mt.exe.aspx"相对=nofollow>这里是另一个链接这是更重要的一点。

Add a manifest to your program so that it always runs with Admin privileges. Here is another link which is more to the point.

这篇关于地址&QUOT;访问被拒绝&QUOT;异常WMI调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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