Skip to content

Set unit package status

Sets the status for a unit package relation.

SetUnitPackageStatus( Byval UnitName as String, Byval UnitType as String, Byval PackageName as String, Byval PackageVersion as String, Byval PackageType as String, Byval Status as String, Optional Byval changelogComment As String = “”) as Boolean

UnitName (String)

The name or UUID of the unit.

UnitType (String)

Type of Unit

  • “Computer”
  • “User”

PackageName (String)

The name of the package

PackageVersion (String)

The package version

PackageType (String)

  • “1” or “Computer”
  • “2” or “User”

Status (String)

Accepted values for package status (not case-sensitive):

  • “Waiting” - the package will be installed according to its schedule. You can change the schedule with the function Set Package Schedule.
  • “Failed”
  • “Installed”
  • “Uninstall” - requires that the current status is Installed, and that the package has an uninstall script. Otherwise, the function returns False.
  • “Cancel” (or “Cancelled”)

Other status values, such as “Installing” or “Advertised”, aren’t accepted.

ChangelogComment (String)

A comment that will be added to the changelog entry on the package and the unit. This parameter is optional.

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

Set oCMS = CreateObject("CapaInstaller.SDK")
Set aList = CreateObject("System.Collections.ArrayList")
Wscript.echo oCMS.SetInstanceManagementPoint("1")
Wscript.echo oCMS.SetUnitPackageStatus("Client1", "Computer", "7-Zip", "v2", "Computer", "Uninstall", "Uninstalled with SDK")
' Set all failed packages on a computer back to Waiting
Set aList = oCMS.GetPackageStatus("AEEC7B69-34A4-4A40-B39D-2FB469E37EB8","Computer")
For Each item In aList
arr = Split(item,"|")
Wscript.echo "Computer Name: " & arr(0) & ". Package Name: " & arr(1) & ". Version: " & arr(2) & ". Status: " & arr(4)
If arr(4) = "Failed" Then
Wscript.echo oCMS.SetUnitPackageStatus("AEEC7B69-34A4-4A40-B39D-2FB469E37EB8", "Computer", arr(1), arr(2), "Computer", "Waiting", "Failed package set to waiting")
End If
Wscript.echo "***************************"
Next