Msi insaller passing paramenter from command promp

2019-05-30 15:21发布

问题:

Installer builder tool: Microsoft Visual Studio 2010 , Project Installer

I am trying to pass username and password for the installer to use for running Windows services that will install by the installer. By default installer ask the Credentials during installation that i want to pass through command prompt. see attached pic I tried the solution that provided in the following issue. But still getting the "Set Service login" dialog during installation.

msiexec /i setup.msi USERNAME=yourUserName PASSWORD=yourPassword

How to Pass Command Line Arguments to MSI Installer

回答1:

Need to redesign Instalation using This http://www.codeproject.com/Articles/16767/How-to-Pass-Command-Line-Arguments-to-MSI-Installe aticle

I use additional for installer class logic:

public override void Install(IDictionary stateSaver)
    {
        if (!String.IsNullOrWhiteSpace(this.Context.Parameters["password"]))
        {
            this.QualsMetricsSchedulerServiceInstaller.Password = this.Context.Parameters["password"];
            this.QualsMetricsSchedulerServiceInstaller.Username = this.Context.Parameters["user"];
        }
        else
        {
            this.Context.Parameters.Remove("user");
            this.Context.Parameters.Remove("password");
            this.QualsMetricsSchedulerServiceInstaller.Password = null;
            this.QualsMetricsSchedulerServiceInstaller.Username = null;
        }
        base.Install(stateSaver);
    }

And CustomActionData: /USERNAME="[USERNAME]" /PASSWORD="[PASSWORD]" Now can install manualy and for silent instal use msiexec /i QualsScheduler.msi /qb username=.\Gavrishdv password=***