Skip to content

Add unit to folder

Adds unit to a folder. The unit is moved out of the folder it was in before.

The unit must be on the Management Point that you selected with Set instance management point. If the unit belongs to a Business Unit, the folder is looked up in that Business Unit.

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

UnitName (String)

The name or UUID of the unit.

UnitType (String)

Type of Unit

  • “Computer”
  • “User”

FolderStructure (String)

The folder structure to which the unit should be added. Separate the folder levels with a backslash, for example Upgrade\cms4. If you specify an empty string, the unit is moved to the root.

CreateFolder (Boolean)

An optional parameter stating whether the folders should be created if they don’t exist. If this is False and the folder doesn’t exist, the function fails. The default value is False.

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

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