# CMS_AddUnitToBusinessUnit

> Adds the unit on which the script is executed to the specified Business Unit. UserJobs add user and ComputerJobs add the computer.

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

### Description

Adds the unit on which the script is executed to the specified Business Unit. UserJobs add user and ComputerJobs add the computer

### Syntax

**VBScript**

```vb
CMS_AddUnitToBusinessUnit(sBusinessUnitName) as Boolean
```

**PowerShell**

```powershell
[bool]CMS_AddUnitToBusinessUnit -businessunitname <string>
```

### Parameters

#### sBusinessUnitName (String)

BusinessUnit name

### Return value

**VBScript**

Boolean, TRUE if function completed successfully.

**PowerShell**

Boolean, TRUE if function completed successfully.

### Example

**VBScript**

```vb
If bStatus Then bStatus = CMS_AddUnitToBusinessUnit("CapaInstaller")
```

**PowerShell**

```powershell
if (CMS_AddUnitToBusinessUnit 'bu_verona') {
  $cs.Job_WriteLog("Added", "Unit added to the Verona Business unit")
}
```

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

### Related functions

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