CMS_GetAdvertisedPackages
Description
Returns all packages advertised to the unit
Syntax
CMS_GetAdvertisedPackages() As Boolean
[CiAdvertisedPackage[]]CMS_GetAdvertisedPackages
Return value
Result will be stored in gaValue
The function will return an array of the type CiAdvertisedPackage;
class CiAdvertisedPackage {
[int]$Jobid
[int]$Type
[string]$Name
[string]$Version
[bool]$Uninstallscript
[string]$Catalogname
[string]$Description
[int]$Advertiseddate
[string]$Groupname
[bool]$Autoexpand
}
Example
VBScript
If bStatus Then bStatus = CMS_GetAdvertisedPackages() Â
If bStatus Then
For index = LBound(gaValue) to UBound(gaValue) Â
xStatus = Job_WriteLog("Custom", "Index #" & index & ": '" & cStr(gaValue(index)) & "'", bStatus, True) Â
NextÂ
End If
PowerShell
foreach ($advpck in CMS_GetAdvertisedPackages) {
$cs.Job_WriteLog("Package Name:", $advpck.Name)
$cs.Job_WriteLog("Package Version:", $advpck.Version)
$cs.Job_WriteLog("Catalog name:", $advpck.Catalogname)
$cs.Job_WriteLog("JobId:", $advpck.Jobid)
$cs.Job_WriteLog("----", "----")
}
# Expected output:
2023-11-19 20:14:04 - Package Name: The Brand New PowerPack 4.5 de
2023-11-19 20:14:04 - Package Version: v1.0
2023-11-19 20:14:04 - Catalog name: The Brand New PowerPack 4.5 de v1.0
2023-11-19 20:14:04 - JobId: 130
2023-11-19 20:14:04 - ---- ----
2023-11-19 20:14:04 - Package Name: The Pack Mule 3.0 eng
2023-11-19 20:14:04 - Package Version: v1.0
2023-11-19 20:14:04 - Catalog name: The Pack Mule 3.0 eng v1.0
2023-11-19 20:14:04 - JobId: 125
2023-11-19 20:14:04 - ---- ----
2023-11-19 20:14:04 - Package Name: The Six Pack 2.0
2023-11-19 20:14:04 - Package Version: v1.0
2023-11-19 20:14:04 - Catalog name: The Six Pack 2.0 v1.0
2023-11-19 20:14:04 - JobId: 127
2023-11-19 20:14:04 - ---- ----
2023-11-19 20:14:04 - Package Name: Welcome to the Packateria 3.33 it
2023-11-19 20:14:04 - Package Version: v1.0
2023-11-19 20:14:04 - Catalog name: Welcome to the Packateria 3.33 it v1.0
2023-11-19 20:14:04 - JobId: 161
2023-11-19 20:14:04 - ---- ----