# Get Unit Relations

> Gets the unit relations of a specified unit.

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

## Description

Gets the unit relations of a specified unit. These include Primary, Default, Current, previously logged on, and manually linked units.

## Syntax

GetUnitRelations(ByVal unitName As String, ByVal unitType As String) As ArrayList

## Parameters

***UnitName (String)***

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

***UnitType (String)***

Type of Unit

- "Computer"
- "User"

## Return value

The function returns an array of units. Each unit (unit) in the array is a joined line with the character defined with [Set splitter](/capainstaller/sdk-capainstaller-software-development-kit-functions/container-functions/set-splitter/).

- Relation type ("Primary User"/"Current User"/"Default User"/"Manually Created"/"Previously logged on User")
- unit.Name
- unit.Created
- unit.LastExecuted
- unit.Status
- unit.Description
- unit.GUID
- unit.ID
- unit.Type.Name
- unit.UUID
- Is mobile ("True"/"False)
- unit.location
- unit.CmpId
- unit.BuId

## Example

**VBScript**

```vb
Set oCMS = CreateObject("CapaInstaller.SDK")
Set arrRelations = CreateObject("System.Collections.ArrayList")
Wscript.echo oCMS.SetInstanceManagementPoint("1")

Set arrRelations = oCMS.GetUnitRelations("Klient","Computer")
For Each item In arrRelations
  Wscript.echo item

  arr=Split(item,"|") 
  Wscript.echo "Relation type: " & arr(0) 
  Wscript.echo "Name: " & arr(1) 
  Wscript.echo "Location: " & arr(11) 
  Wscript.echo "Status: " & arr(4) 
  Wscript.echo "***************************" 
Next
```
