# MSI_IsPackageInstalledByGuid

> Test if specified package has been installed based on product code.

Source: https://docs.capaone.com/capainstaller/vb-scripting-library/msi-functions/msi-ispackageinstalledbyguid/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Test if specified package has been installed based on product code

### Syntax

MSI_IsPackageInstalled(sProductCode, bMustExist) As Boolean

### Parameters

#### sProductCode (String)

ProductCode of the MSI-package

#### bMustBeInstalled (Boolean)

Function will return false if bMustBeInstalled is true and package is not installed

### Return value

Result will be stored in gbValue

## Example

**VBScript**

```vb
If bStatus Then bStatus = MSI_IsPackageInstalledByGuid("{38c5a3b5-8501-4d2e-8713-fc4116f5f519}", False)
If bStatus Then bStatus = Job_WriteLog("Custom", "gbValue: " & gbValue, bStatus, True)
```

[Scripting Guidelines](/capainstaller/vb-scripting-library/scripting-guidelines/)

### Related functions

[MSI_InstallPackage](/capainstaller/vb-scripting-library/msi-functions/msi-installpackage/) [MSI_UnInstallByFile](/capainstaller/vb-scripting-library/msi-functions/msi-uninstallbyfile/) [MSI_GetPackageStatus](/capainstaller/vb-scripting-library/msi-functions/msi-getpackagestatus/) [Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/)
