将进程作为管理权限运行。

编程入门 行业动态 更新时间:2024-10-26 16:30:31
本文介绍了将进程作为管理权限运行。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建了一个wpf应用,其中包含 管理权限。

I created one wpf app withAdministrativepermission.

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

但是现在我需要运行这个应用程序,例如as -

public static void Main(string[] args) { Process p = new Process(); p.StartInfo.UseShellExecute = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; p.StartInfo= new ProcessStartInfo(@"C:\Program Files (x86)\Uniguest\AktivKiosk\Uniguest.WpfClient.exe"); p.Start(); }

我不想提示管理权限窗口,但它会自动作为管理权限打开。

I do not want to prompt window for administrative privilege but its automatically open as administrative permission.

有可能吗?实际上我想通过机器上的服务运行这个应用程序。并且没有任何用户可以手动授予许可

does it possible? actually i want to run this app via service on the machine. And no any user available for give permission manually

请帮助我。

谢谢

推荐答案

如果不触发提示,则无法从非提升的进程中提升进程。那将是一个安全漏洞。通过指定清单中需要管理员权限,用户在运行应用程序时将收到提示,除非他们已经从提升的令牌运行。这是设计使然。

You cannot elevate a process from a non-elevated process without triggering a prompt. That would be a security hole. By specifying that admin rights are required in the manifest the user will get prompted when they run the app unless they are already running from an elevated token. This is by design.

如果您需要以编程方式执行此操作,请先提升您的流程,然后启动其他流程。

If you need to do this programmatically then elevate your process first, then start the other process.

更多推荐

将进程作为管理权限运行。

本文发布于:2023-11-11 06:47:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577668.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:管理权限   进程

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!