KB0078 - Service fails to start during PowerShell Universal v5 Upgrade when using SQLite and MSI

KB0078 - Service fails to start during PowerShell Universal v5 Upgrade when using SQLite and MSI

Scope

Users that are upgrading from PowerShell Universal v4 to PowerShell Universal v5 using the MSI and SQLite persistence database. 

Problem

The service may not start in a timely manner and cause the MSI process to fail. 

Root Cause

PowerShell Universal v5 introduced new indices on tables within the PSU database that may be large in size. These include the LogEntry and JobOutput tables. Building these indices can take time and Service Control Manager may not wait for the service to fully start before giving up. 

Solution

In order to successfully upgrade, you may need to update the database schema outside of the MSI process. You can use one of the following methods to do so. 

Prior to 5.0.6

1. Stop the PowerShell Universal service and backup the data according to upgrade documentation
2. Uninstall the PowerShell Universal v4 service
4. Extract the ZIP file and run the Universal.Server.exe executable as an administrator
5. Allow the PSU service to migrate the database file. This can take some time. Once logging begins in the console window, the process is complete, and you can close the window.
6. Download and install PowerShell Universal v5. 

5.0.6 and Later

1. Stop the PowerShell Universal service and backup the data according to upgrade documentation
2. Uninstall the PowerShell Universal v4 service
4. Extract the ZIP file and run the psudb.exe as administrator with the following command line arguments: -p <path to database file> -m
5. This will perform a database migration and will print out when it has completed. 
6. Download and install PowerShell Universal v5. 

    • Related Articles

    • PowerShell Universal Service crashes on startup after an upgrade to 1.4.6

      Version: PowerShell Universal 1.4.6 Issue The PowerShell Universal service will crash with the following error in Event Viewer.  Application: Universal.Server.exe CoreCLR Version: 4.700.19.56402 .NET Core Version: 3.1.0 Description: The process was ...
    • KB0025 - Universal Server fails to start automatically

      Applicability This article applies to PowerShell Universal (Kestrel version*) running on Windows. If you have PowerShell Universal running under IIS or another OS then this article does not apply. Symptom Even though the PowerShell Universal service ...
    • KB0032 - (Windows) About the difference between the MSI and ZIP installs

      Question What's the difference between the MSI and ZIP installations of PowerShell Universal for Windows operating systems? Answer The MSI install is a self-contained web hosting platform using Microsoft Kestrel[1]. The ZIP installer is intended for ...
    • PowerShell Universal crashes after upgrade to 1.5

      Version: 1.5 Issue: The PowerShell Universal service will not start properly when upgrading from 1.4 to 1.5. The following error is shown in the log.  Unhandled exception. System.InvalidCastException: Unable to cast object of type ...
    • KB0036 - How to set the license via environment variable

      Purpose The purpose of this article is to explain how to set the license for PowerShell Universal by way of environment variable instead of the traditional file-based method. Scope For now, only Windows is in the scope of this article. Linux and ...