Description
The function returns which groups the current Unit is a member of
For Business Unit support click here
Syntax
CMS_GetGroupMembership() As Boolean
[CiGroup[]]CMS_GetGroupMembership
Return value
Result will be stored in gaValue
The function will return an array of the type CiGroup:
class CiGroup { [string]$Unittype [int]$Id [string]$Name [string]$Description [string]$Type [string]$Typedisplayname [string]$Icon [int]$Cmpid [string]$Scheduleid [bool]$Groupdeleted [string]$Businessunitid [int]$Linkedprofilecount [int]$Linkedapplicationcount [int]$Linkedpackagecount [int]$Linkedunitcount [int]$Folderid [string]$Guid [string]$Objecttype [int]$Parentid [int]$Packagetype [int]$Reinstallid [string]$Mode [DateTime]$Lastexecuted [int]$Pointid [int]$Osimageid [int]$Diskconfigid [int]$Installtypeid [int]$Osserverid [bool]$Clearallpackages [bool]$Clearallpackagesandgroups [object]$Customfield1 [object]$Customfield2 }
Example
VBScript
If bStatus Then bStatus = CMS_GetGroupMembership() For index = LBound(gaValue) to UBound(gaValue) xStatus = Job_WriteLog("Custom", "Index #" & index & ": '" & cStr(gaValue(index)) & "'", bStatus, True) Next
PowerShell
CMS_GetGroupMembership | ForEach-Object { $cs.Job_WriteLog("Group Name: ", $_.Name) $cs.Job_WriteLog("Description: ", $_.Description) $cs.Job_WriteLog("Type: ", $_.Type) $cs.Job_WriteLog("TypeDisplayName: ", $_.Typedisplayname) $cs.Job_WriteLog("Id: ", $_.Id) $cs.Job_WriteLog("Guid: ", $_.Guid) $cs.Job_WriteLog("CmpID: ", $_.Cmpid) $cs.Job_WriteLog("------","------") } # Expected output: 2023-11-19 20:38:25 - Group Name: calendar1 2023-11-19 20:38:25 - Description: First Calendar 2023-11-19 20:38:25 - Type: 1 2023-11-19 20:38:25 - TypeDisplayName: Calendar 2023-11-19 20:38:25 - Id: 5027 2023-11-19 20:38:25 - Guid: 20e9a444-62c1-464e-bf6f-5994fd47f37a 2023-11-19 20:38:25 - CmpID: 1 2023-11-19 20:38:25 - ------ ------ 2023-11-19 20:38:25 - Group Name: Static One 2023-11-19 20:38:25 - Description: First Static test group 2023-11-19 20:38:25 - Type: 7 2023-11-19 20:38:25 - TypeDisplayName: Static 2023-11-19 20:38:25 - Id: 5025 2023-11-19 20:38:25 - Guid: 6b11640d-8303-4b92-8090-e646d025f9cf 2023-11-19 20:38:25 - CmpID: 1 2023-11-19 20:38:25 - ------ ------