# CMS_AddComputerToDepartmentGroup

> Adds a specified computer to the specified department group.

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

### Description

Adds a specified computer to the specified department group

It will be unlinked from current department group (if any), since a computer only can be in one department group

For Business Unit support click [Business Unit support](/capainstaller/vb-scripting-library/addendum/business-unit-support/)

### Syntax

**VBScript**

```vb
CMS_AddComputerToDepartmentGroup(sUnit, sGroup) as Boolean
```

**PowerShell**

```powershell
[bool] CMS_AddComputerToDepartmentGroup -group <string>
```

### Parameters

#### sUnit (String)

Unit name

#### sGroup (String)

Group 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_AddComputerToDepartmentGroup(gsUnitName, "CapaInstaller")
```

**PowerShell**

```powershell
If (CMS_AddComputerToDepartmentGroup -group 'CapaInstaller') {
    $cs.Job_WriteLog("Added", "Computer added to department group: 'CapaInstaller'")
}
```

[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/)
