# $cs.MSI_IsMSIGuidInstalled

> Checks whether a product with the given ProductCode GUID is currently installed, by querying Windows Installer's product state directly — no MSI file needed, just the.

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

### Description

Checks whether a product with the given ProductCode GUID is currently installed, by querying Windows Installer's product state directly — no MSI file needed, just the GUID. Windows-only.

### Syntax

$cs.MSI\_IsMSIGuidInstalled(string msiguid)

### Parameters

#### msiguid (String)

ProductCode GUID to check the installation status of.

### Return value

Boolean, `$true` if a product with this GUID is installed. Returns `$false` on any error rather than throwing.

### Example

**PowerShell**

```powershell
if ($cs.MSI_IsMSIGuidInstalled('{AC76BA86-1033-FF00-7760-BC15014EA700}')) {
  $cs.Job_WriteLog("Product is already installed, skipping install")
}
```

Use the same guard with a hardcoded GUID inside `PreInstall`, which is useful when the kit downloads its MSI separately at install time rather than shipping it in the package:

```powershell
function PreInstall {
  $cs.Log_SectionHeader('PreInstall', 'o')
  $knownProductCode = '{AC76BA86-1033-FF00-7760-BC15014EA700}'
  if ($cs.MSI_IsMSIGuidInstalled($knownProductCode)) {
    Exit-PSScript -exitcode 3330 -exitmessage "$global:AppName ($knownProductCode) is already installed, nothing to do"
  }
}
```

### Related functions

[$cs.MSI_GetProductCodeFromMSI](/capainstaller/powerpacks/cs-msi-getproductcodefrommsi/) [$cs.MSI_IsMSIFileInstalled](/capainstaller/powerpacks/cs-msi-ismsifileinstalled/)
