/
Get Units in Folder
Get Units in Folder
Description
Gets a list of units in either a folder or in the root of either a Business Unit or Global.
Syntax
GetUnitsInFolder(ByVal folderStructure As String, ByVal unitType As String, ByVal businessUnitName As String) as ArrayList
Parameters
FolderStructure (String)
Example: Folder1/Folder2/Folder3
If this parameter is left blank, units that are located in the root will be returned.
UnitType (String)
Type of unit folder.
- "Computer"
- "User"
BusinessUnitName (String)
Example: "Sales"
If this parameter is left blank, units from Global are returned.
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.
- unit.Name
- unit.Created
- unit.LastExecuted
- unit.Status
- unit.Description
- unit.GUID
- unit.ID
- unit.Type.Name
- unit.UUID
- Unit.IsMobileDevice ("True" or "False")
- unit.location
Example
VBScript
Set oCMS = CreateObject("CapaInstaller.SDK") Wscript.echo oCMS.SetDefaultManagementPoint("1") Set arrComputers1 = CreateObject("System.Collections.ArrayList") Set arrComputers2 = CreateObject("System.Collections.ArrayList") Set arrComputers3 = CreateObject("System.Collections.ArrayList") Set arrUsers1 = CreateObject("System.Collections.ArrayList") Set arrUsers2 = CreateObject("System.Collections.ArrayList") Set arrComputers1 = oCMS.GetUnitsInFolder("Folder1\Folder2\Folder3", "Computer", "") Wscript.echo "Computers/devices in Global Folder1\Folder2\Folder3: " + Cstr(arrComputers1.Count) For Each item In arrComputers1 Wscript.echo item Next Wscript.echo "***************************" Set arrComputers2 = oCMS.GetUnitsInFolder("", "Computer", "Skanderborg") Wscript.echo "Computers/devices in root of BU Skanderborg: " + Cstr(arrComputers2.Count) For Each item In arrComputers2 Wscript.echo item Next Wscript.echo "***************************" Set arrComputers3 = oCMS.GetUnitsInFolder("", "Computer", "") Wscript.echo "Computers/devices in root of Global: " + Cstr(arrComputers3.Count) For Each item In arrComputers3 Wscript.echo item Next Wscript.echo "***************************" Set arrUsers1 = oCMS.GetUnitsInFolder("UserFolder1\UserFolder2\", "User", "") Wscript.echo "Users in UserFolder1\UserFolder2: " + Cstr(arrUsers1.Count) For Each item In arrUsers1 Wscript.echo item Next Wscript.echo "***************************" Set arrUsers2 = oCMS.GetUnitsInFolder("", "User", "") Wscript.echo "Users in Root of Global: " + Cstr(arrUsers2.Count) For Each item In arrUsers2 Wscript.echo item Next Wscript.echo "***************************"
, multiple selections available,
Related content
Get Units in Folder
Get Units in Folder
More like this
Get Units in Folder
Get Units in Folder
More like this
Get units on business unit
Get units on business unit
More like this
Get units on business unit
Get units on business unit
More like this
Get units on business unit
Get units on business unit
More like this
Get units on business unit
Get units on business unit
More like this