# $cs.MSI_GetPropertyFromMSI

> Reads a single named property (e.g. "ProductVersion", "ProductName", "Manufacturer", "ProductCode") from an MSI file's internal property table.

Source: https://docs.capaone.com/capainstaller/powerpacks/cs-msi-getpropertyfrommsi/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Reads a single named property (e.g. `"ProductVersion"`, `"ProductName"`, `"Manufacturer"`, `"ProductCode"`) from an MSI file's internal property table. Windows-only.

### Syntax

$cs.MSI\_GetPropertyFromMSI(string msifile, string property)

### Parameters

#### msifile (String)

Path to the MSI file to read from. Throws a `FileNotFoundException` if this file doesn't exist.

#### property (String)

Name of the property to retrieve.

### Return value

String, the property value, or `$null` if the property isn't set in the MSI.

### Example

**PowerShell**

Read the ProductVersion from the kit's MSI simply to log it:

```powershell
$msiFile = Join-Path $global:Packageroot "pdfsam.msi"
$msiProductVersion = $cs.MSI_GetPropertyFromMSI($msiFile, "ProductVersion")
$cs.Job_WriteLog("MSI ProductVersion: $msiProductVersion")
```

Compare the kit's ProductVersion against a version already recorded on the machine, and skip installation if it's not newer:

```powershell
$msiFile = Join-Path $global:Packageroot "pdfsam.msi"
$kitVersion = [version]$cs.MSI_GetPropertyFromMSI($msiFile, "ProductVersion")
$installedVersion = [version]$cs.Ini_ReadEntry("$env:ProgramData\Contoso\App\settings.ini", "app", "installedVersion")
if ($installedVersion -and ($installedVersion -ge $kitVersion)) {
  $cs.Job_WriteLog("Installed version $installedVersion is already up to date, skipping install")
}
```

### Related functions

[$cs.MSI_GetPropertiesFromMSI](/capainstaller/powerpacks/cs-msi-getpropertiesfrommsi/)
