Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

The function returns which groups the current Unit is a member of

For Business Unit support click here

Syntax

(blue star) CMS_GetGroupMembership() As Boolean

(blue star) [CiGroup[]]CMS_GetGroupMembership

Return value

(blue star) Result will be stored in gaValue

(blue star) The function will return an array of the type CiGroup:

Code Block
languagepowershell
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

(blue star) VBScript
Code Block
languagevb
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
(blue star) PowerShell
Code Block
languagepowershell
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 - ------ ------
  

Scripting Guidelines

Related functions