简体   繁体   English

在没有UAC或App的情况下如何以静默方式安装以管理员身份运行?

[英]How to do Silent installation without UAC or App Is running as admin?

I want to do Silent installation. 我要执行静默安装。 I know the command which do that "msiexec.exe /qn", but i can't do that if my application isn't running as administrator. 我知道执行该命令的命令“ msiexec.exe / qn”,但是如果我的应用程序未以管理员身份运行,则无法执行该命令。 note:- my msi installer is created using WIX Toolset 注意:-我的msi安装程序是使用WIX Toolset创建的

Process process = new Process
        {
            StartInfo =
            {
                FileName = @"msiexec.exe",
                Arguments = string.Format(@"/i ""E:\Build 16\ColiboConnect.msi"" /qn"),
                UseShellExecute = false,
                RedirectStandardInput = true,
                RedirectStandardOutput = true,
                RedirectStandardError = true,
                CreateNoWindow = false
            }
        };
        process.Start();
        process.WaitForExit();

You are requesting silent MSI installation therefore MSI will not display any UI - nor the UAC dialog. 您正在请求静默MSI安装,因此MSI将不显示任何UI-也不显示UAC对话框。

Your parent process must already run with elevated privileges, or you must request elevation from Windows and use the privileges token to run new process. 您的父进程必须已经以提升的特权运行,或者您必须从Windows请求提升并使用特权令牌运行新进程。

We solved our problem using Windows Service. 我们使用Windows服务解决了我们的问题。 Our app will download the new msi, then call a WCF service, passing the path of the installer and the Service will install the new version without any problems because our service run under local account system and i think this is the only supported solution 我们的应用程序将下载新的msi,然后调用WCF服务,并通过安装程序的路径,并且该服务将安装新版本而不会出现任何问题,因为我们的服务在本地帐户系统下运行,我认为这是唯一受支持的解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM