Photo by Markus Winkler / Unsplash
Retrieving MSI file information with PowerShell

Retrieving MSI file information with PowerShell

Published on 26 Jan 2023

Bastien Perez
Bastien Perez

Clap

An MSI (Microsoft System Installer) file is a format specific to Microsoft used for installing applications on a Windows computer.

An .msi file contains information about the application to be installed, such as the version, the publisher's name, the necessary files, configuration settings, etc. The information in the MSI is sometimes displayed in the Properties > Details. However, some MSI files contain no information about a property.

For example, the AutomatedLab installer MSI file does not contain any information about the version:

Some information about an msi file may be empty

In order to obtain this information, I developed a small PowerShell script to retrieve the information from an MSI file:

  • FileName: name of the MSI file
  • FilePath: full path of the MSI file
  • Length (MB): size of the MSI file in megabytes
  • ProductVersion: version of the product (application) contained in the MSI file
  • ProductCode: GUID generated by Windows Installer to identify the installed product
  • ProductName: name of the installed product Manufacturer: name of the product publisher
  • ProductLanguage: code of the product language
  • UpgradeCode: GUID representing a set of related products.

It also contains the information visible in the Details (SummaryInformation).

If a property does not exist in the MSI, the returned object will still have this property but it will be empty.

The script is available on my GitHub.

To run it:

# Load the function
. .\Get-MSIFileInformation.ps1

# Type the file in the parameter -FilePath
Get-MSIFileInformation -FilePath C:\temp\AutomatedLab.msi

The result is as follows:

FileName        : AutomatedLab.msi
FilePath        : C:\temp\AutomatedLab.msi
Length(MB)      : 17,1645622253418
ProductVersion  : 5.46.0
ProductCode     : {E674472C-F8CA-411E-9A54-019AD2233AAC}
ProductName     : AutomatedLab
Manufacturer    : AutomatedLab Team
ProductLanguage : 1033 (English)
UpgradeCode     : {6A52C22C-74F0-4CC3-B723-B73A21DB9149}
Codepage        : 1252
Title           : Installation Database
Subject         : AutomatedLab Installer
Author          : AutomatedLabTeam
Keywords        : Installer
Comment         : AutomatedLab Modules Installer
Template        : x64;1033
LastAuthor      :
RevisionNumber  : {0936ECF3-4285-496C-8F60-31B0E08101B2}
EditTime        :
LastPrinted     :
CreationDate    : 24/11/2022 13:17:34
LastSaved       : 24/11/2022 13:17:34
PageCount       : 200

Comments

banner-Bastien Perez
Bastien Perez

Freelance Microsoft 365 - Active Directory - Modern Workplace

France