我创建了一个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.
更多推荐
将进程作为管理权限运行。
发布评论