# CMS_AddPackageToUnit

> Adds the specified package to the unit on which the script is being executed.

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

### Description

Adds the specified package to the unit on which the script is being executed

### Syntax

**VBScript**

```vb
CMS_AddPackageToUnit(sPackage, sVersion) as Boolean
```

**PowerShell**

```powershell
[bool] CMS_AddPackageToUnit -package <string> -version <string>
```

### Parameters

#### sPackage (String)

Package name

#### sVersion (String)

Package version

### Return value

**VBScript**

Boolean, TRUE if function completed successfully.

**PowerShell**

Boolean, TRUE if function completed successfully.

### Example

**VBScript**

```vb
If bStatus Then bStatus = CMS_AddPackageToUnit("CapaInstaller", "v1.0")
```

**PowerShell**

```powershell
if (CMS_AddPackageToUnit -package 'Il pacchetto perfetto 2.0 IT' -version 'v1.0') {
  $cs.Job_WriteLog("Added", "The Perfect package was added to the unit")
  $cs.Job_WriteLog("And..", "It's not even the old version 1.8 :) ")
}
```

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

### Related functions

[CMS_RemovePackageFromUnit](/capainstaller/vb-scripting-library/cms-functions/cms-removepackagefromunit/) [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/)
