# CMS_ExistPackageOnManagementServer

> Checks if the specified package exists on the management server the agent is connected to.

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

### Description

Checks if the specified package exists on the management server the agent is connected to

### Syntax

**VBScript**

```vb
CMS_ExistPackageOnManagementServer(sPackage, sVersion, bMustExist) as Boolean
```

**PowerShell**

```powershell
[bool]CMS_ExistPackageOnManagementServer -package <string> -version <string> -mustexist <bool>
```

### Parameters

#### sPackage (String)

Name of the package

#### sVersion (String)

Version of the package

#### bMustExist (Boolean)

Should missing package make the function return false

### Return value

**VBScript**

Boolean, TRUE if function completed successfully.

**PowerShell**

Boolean, TRUE if function completed successfully.

### Example

**VBScript**

```vb
If bStatus Then bStatus = CMS_ExistPackageOnManagementServer("TestPackage", "v1.0", False)
If bStatus And gbValue Then bStatus = Job_WriteLog("Custom", "Package exists", bStatus, True)

```

**PowerShell**

```powershell
if (CMS_ExistPackageOnManagementServer 'TestPackage' 'v1.0' $false) {
  $cs.Job_WriteLog("Exists", "TestPackage exists on the management server")
}
```

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

### Related functions

[Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/) [Business Unit support](/capainstaller/vb-scripting-library/addendum/business-unit-support/)
