# Add unit to folder

> Adds a unit to a folder, optionally creating the folder if it does not exist.

Source: https://docs.capaone.com/capainstaller/sdk-capainstaller-software-development-kit-functions/unit-functions/add-unit-to-folder/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

## Description

Adds unit to a folder.

## Syntax

AddUnitToFolder(Byval UnitName  as  String,  Byval UnitType  as  String,  Byval FolderStructure  as  String, Optional  Byval  CreateFolder  as  Boolean = False)  as  Boolean

## Parameters

***UnitName (String)***

The name of the unit, or the uuid of the unit

***UnitType (String)***

Type of Unit

- "Computer"
- "User"

***FolderStructure (String)***

The folder structure to which the unit should be added

**CreateFolder (Boolean)**

An optional parameter stating wether the folder should be created if it does not exist. Default value is; False

## Return value

 Boolean. The function returns True if successful, otherwise false.

## Example

**VBScript**

```vb
Set oCMS = CreateObject("CapaInstaller.SDK") 
wscript.echo oCMS.SetInstanceManagementPoint("1") 
wscript.echo oCMS.AddUnitToFolder("Klient","Computer","Upgrade\cms4",true) 
```
