如何获得使用System.Diagnostics.Process.GetProcess(string)的权限?
我正在使用 Microsoft Visual Studio 制作一个简单的远程任务管理器以供体验。
我想使用 Process.GetProcesses(string); 但存在访问被拒绝异常,不允许我获取远程计算机进程。事实上这是正常的,因为我们应该使用用户名和密码进行身份验证,但如何?
I'm using Microsoft Visual Studio to make a simple remote task manager for experience purposes.
I want to use Process.GetProcesses(string);
but there is an access denied exception that won't allow me to get the remote computer process. In fact it is normal because we should authenticate using a user name and password, but how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试使用WMI来实现此目的
有关Win32_Process 类请参阅 MSDN。
哈
You may try to use WMI for this purpose
For further details on Win32_Process class see MSDN.
hth
编辑:再次阅读您的帖子,我的帖子中描述的步骤仅适用于域,我假设您在工作组中工作。对不起。
我最近在 Windows 7 上以管理员身份运行 Visual Studio 时遇到了类似的问题。如果您将程序提升为以本地管理员身份运行,远程计算机和网络共享上的权限似乎会被删除(即使在域中!),这将是如果您在 VS 以管理员身份运行时在 VS 之外运行程序,就会出现这种情况。如果您拥有域范围的管理员帐户,甚至会发生这种情况。
尝试以下操作:
从 Windows 资源管理器获得远程计算机上的权限,无需提升
如果这有帮助,您可以停止以管理员身份运行 VS。这对我来说很有效。
EDIT: Just read your post again, the steps described in my post only apply in a domain, I assume you work inside a workgroup. I'm sorry.
I recently ran into a similar issue when running Visual Studio as Administrator on Windows 7. It seems like permissions on remote machines and network shares are dropped (even in a domain!) if you elevate your program to run as local administrator, which will be the case if you run a program out of VS when VS is run as admin. This even happens if you have domain wide admin accounts.
Try the following:
privileges on the remote computer from windows explorer, without elevation
If this helps, you could stop running VS as administrator. It worked out for me.
我很确定您需要提升才能执行此操作,或者至少通过 冒充
I'm pretty sure you need elevation to do this, or at least use a stronger user by impersonation