# $cs.MSI_GetPropertiesFromMSI

> Reads several named properties from an MSI file at once. Windows-only.

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

### Description

Reads several named properties from an MSI file at once. Windows-only.

### Syntax

$cs.MSI\_GetPropertiesFromMSI(string msifile, Array property)

### Parameters

#### msifile (String)

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

#### property (Array)

Array of property names to retrieve, e.g. `@("ProductCode","ProductVersion")`.

### Return value

Hashtable keyed by property name, or `$null` if the `property` array is empty or null.

### Example

**PowerShell**

Read several MSI properties up front and store them in globals for later use throughout the script:

```powershell
$msiFile = Join-Path $global:Packageroot "pdfsam.msi"
$msiProperties = $cs.MSI_GetPropertiesFromMSI($msiFile, @("ProductVersion","UpgradeCode","ProductCode","ProductName","Manufacturer"))
if ($msiProperties) {
  [string]$global:Msiproductversion = $msiProperties["ProductVersion"]
  [string]$global:Msiupgradecode = $msiProperties["UpgradeCode"]
  [string]$global:Msiproductcode = $msiProperties["ProductCode"]
  [string]$global:MsiProductName = $msiProperties["ProductName"]
  [string]$global:MsiManufacturer = $msiProperties["Manufacturer"]
}
```

Read just `ProductCode` and `ProductVersion` together for a single inventory-style log line:

```powershell
$msiFile = Join-Path $global:Packageroot "pdfsam.msi"
$props = $cs.MSI_GetPropertiesFromMSI($msiFile, @("ProductCode","ProductVersion"))
if ($props) {
  $cs.Job_WriteLog("Deploying ProductCode $($props['ProductCode']), version $($props['ProductVersion'])")
}
```

### Related functions

[$cs.MSI_GetPropertyFromMSI](/capainstaller/powerpacks/cs-msi-getpropertyfrommsi/)
