SQL Server 2019 setup-via-PowerShell error: "Error: Action "UpgradeMsiTimingAction" failed during execution"

Jerry Lewis 1 Reputation point
2021-06-07T20:06:35.407+00:00

Hi,

I am writing a PowerShell (PS) script to install SQL Server 2019 in an unattended mode. I am receiving an error: "Error: Action "UpgradeMsiTimingAction" failed during execution".

Mostly I use a .INI file to specify the install parameters, but I also pass a number of them on the command line to Setup.exe. While developing my script, I have attempted an unattended setup (via my PS script) and then manually uninstalled it (via Control Panel) a number of times during my testing.

The first thing that I noticed in Summary.txt is /ACTION=uninstall, but I am appear to be passing /ACTION=install on the command line, and there is only one occurrence of /ACTION= within my command line parameters.

I saw a 2013 post where someone with very similar symptoms was told to uninstall Microsoft Visual Studio Tools for Applications. I was able to uninstall the language file but not the 2015 or 2017 version of Tools for Applications (the Uninstall button is unclickable).

I manually uninstalled everything that had "SQL Server" in its' name. I successfully re-installed everything by manually launching Setup.exe (i.e. not using the PS script). Then, I uninstalled everything again and executed the PS script - only to have it fail the same was as before. So, maybe there is something incorrect with my parameter value specifications.

Within PS, I do the following:
$Proc = Start-Process -NoNewWindow -FilePath $SQLsetupFullPath -PassThru -ArgumentList $ScriptedSetupOptions
(Start-Process returns immediately vs waiting for Setup.exe to complete, although I understood -PassThru and some other attempted options would make it wait). Could my "UpgradeMSItimingAction" error be due to exiting too soon and dismounting Setup.exe before Setup.exe has completed?

I have the latest version of 2019 SQL Server. Also, I have: VS Microsoft Visual Studio Professional 2019 Version 16.9.5.

I attempted to attach Summary.txt and Detail.txt.

Thank you.

103037-summary.txt103038-detail.txt

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,636 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Cris Zhan-MSFT 6,626 Reputation points
    2021-06-08T03:18:32.14+00:00

    Hi,

    The summary file you showed is about uninstalling SQL Server.

    Can you try to Install SQL Server from the Command Prompt?
    https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt?view=sql-server-ver15

    Or Install SQL Server with PowerShell Desired State Configuration
    https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-with-powershell-desired-state-configuration?view=sql-server-ver15

    0 comments No comments

  2. Jerry Lewis 1 Reputation point
    2021-06-08T14:45:25.877+00:00

    Thank you for your expeditious response.

    Yes indeed, the Summary file was about an UNINSTALL even though I passed /ACTION=INSTALL on the command line.

    I have successfully installed SQL Server by launching it from Explorer vs. using the PS script. Regardless, when using the PowerShell ISE, I can execute Setup as a command within the PS command window. For the first time, I could see that Setup was complaining about /SQLCOLLATION being incorrect. I used the instructions at: https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt?view=sql-server-ver15
    Those instructions imply that I should double quote the SQL Collation value. However, once I removed the double quotes, then Setup went further.

    Now, I have a different problem (below, "E3Retail" is my instance name). Error message:
    "Virtual Account 'NT Service\SQLAgent' provided for 'SQLAgent$E3RETAIL' is either not a valid account or cannot be used for this service."

    Perhaps Setup.exe appends the "$" + Instance name to whatever I pass, but the documentation makes it appear as though I should be passing what I am passing.
    Therefore, I removed the Setup parameter /AGTSVCACCOUNT (relying on the Setup to use a default value). However, that failed the same way.
    This problem could be another example of not using double quotes when I should or vice versa, and this problem could, of course, exist on any parameter - causing the current error to occur "down the line".

    Below are the command line parameters that I am using, and I have attached an updated Summary.txt:

    /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /INSTANCENAME="E3Retail" /ENU="True" /UpdateEnabled="True" /FEATURES=SQLengine,Tools /INSTALLSQLDATADIR="C:\Program Files\Microsoft SQL Server\MSSQL15.E3Retail\MSSQL\DATA" /SQLCOLLATION=SQL_Latin1_Ge
    neral_CP1_CI_AS /SQLSYSADMINACCOUNTS="E3\jlewis" "E3\jlewis-A" "E3\CMcGhee" "E3\CMcGhee-A" "E3\DSG-All-Dev" "E3\DSG-All-Dev-A" "E3\BBY-TPloader-SVC" /AGTSVCACCOUNT="NT Service\SQLAgent$E3Retail" /AGTSVCSTARTUPTYPE="Automatic" /BROWSERSVCSTARTUPT
    YPE="Automatic" /SQLSVCACCOUNT="NT Service\MSSQL$E3Retail" /SQLSVCSTARTUPTYPE="Automatic" /TCPENABLED=1 /NPENABLED=1 /CONFIGURATIONFILE="C:\LaptopDesktop\utility scripts\SQL\RDBmanagement.SQLServer\Install\SQLserver.InstallUnattended\SQLserver.In
    stallViaSetup.LabBase.ini"

    Thank you.

    103531-summary.txt


  3. Jerry Lewis 1 Reputation point
    2021-06-09T12:44:05.757+00:00

    Yes, you understood me correctly. I get the same error message without /AGTSVCACCOUNT.

    By using a configuration file, I can have different configurations for different lab locations. For example, for the lab in Raleigh, I would have one configuration file and for the lab in San Diego, I would have a different one. The PS script is, of course, intended to override parameters in the Configuration file. So, I need the configuration file in the final solution. However, I can certainly test to see what happens without it for problem determination.

    Below are the parameters that I am passing to Setup.exe for this test. However, when I execute Setup.exe with these parameters (i.e. without the Configuration file), then Setup no longer executes in unattended mode. Instead, the GUI pops up and prompts me to answer installation configuration questions. When attempting to use the Setup GUI with the same values that I have below, then Setup runs fine.

    /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /INSTANCENAME="E3Retail" /ENU="True" /UpdateEnabled="True" /FEATURES=SQLengine,Tools /INSTALLSQLDATADIR="C:\Program Files\Microsoft SQL Server\MSSQL15.E3Retail\MSSQL\DATA" /SQLCOLLATION=SQL_Latin1_Ge
    neral_CP1_CI_AS /SQLSYSADMINACCOUNTS="E3\jlewis" "E3\jlewis-A" "E3\CMcGhee" "E3\CMcGhee-A" "E3\DSG-All-Dev" "E3\DSG-All-Dev-A" "E3\BBY-TPloader-SVC" /BROWSERSVCSTARTUPTYPE="Automatic" /SQLSVCACCOUNT="NT Service\MSSQL$E3Retail" /SQLSVCSTARTUPTYPE
    ="Automatic" /TCPENABLED=1 /NPENABLED=1

    Jerry


  4. Jerry Lewis 1 Reputation point
    2021-06-14T12:31:52.003+00:00

    Yes, I am aware of the /Q parameter. However, Setup was failing, I was not getting an error code, and the error logs (e.g. Summary.txt) are not necessarily easy to interpret in all cases. So, I removed /Q to see what was failing. Regardless, your comment is not clear. Is /Q responsible for the "Upgrade MSI Timing Action" error?

    Have you attempted to recreate my symptoms by executing Setup.exe with the parameters that I specified or are you simply looking at the parameters to see what looks wrong? It should not be necessary to execute Setup from PS to recreate the problem. I can recreate the problem by executing Setup.exe (with my parameters) from both the PS command prompt and the batch command prompt (%windir%\system32\cmd.exe).

    What is the correct way for a PS script to retrieve the Setup.exe return code (e.g. ERRORLEVEL in batch programming)?
    Originally, I used "&" to execute Setup.exe. However, when I did not receive a return code, I started using:
    $Proc = Start-Process -NoNewWindow -FilePath "$SQLsetupFullPath" -PassThru -ArgumentList $ScriptedSetupOptions

    However, it is not clear that Start-Process is getting an error code either. I have attempted to retrieve the Setup.exe exit code with the following:
    $RC = $proc.ExitCode
    and
    $LastExitCode

    What will LastExitCode contain if Setup.exe fails Is it an indicator of success/failure or one of an enumerated list of error codes? If so, where can I find documentation for the enumerations? I assume once I have the error code, I would Google it and/or review Summary.txt?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.