将进程作为管理权限运行。 [英] Run process as administrative privilege.

查看:79
本文介绍了将进程作为管理权限运行。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I created one wpf app with  Administrative permission.

<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. 


这篇关于将进程作为管理权限运行。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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