CMS_ExistPackageOnManagementServer
Description
Section titled “Description”Checks if the specified package exists on the management server the agent is connected to
Syntax
Section titled “Syntax”CMS_ExistPackageOnManagementServer(sPackage, sVersion, bMustExist) as Boolean[bool]CMS_ExistPackageOnManagementServer -package <string> -version <string> -mustexist <bool>Parameters
Section titled “Parameters”sPackage (String)
Section titled “sPackage (String)”Name of the package
sVersion (String)
Section titled “sVersion (String)”Version of the package
bMustExist (Boolean)
Section titled “bMustExist (Boolean)”Determines what happens if the package doesn’t exist on the management server. If True, the function returns False. If False, the function returns True and sets gbValue to False.
Return value
Section titled “Return value”Boolean, TRUE if function completed successfully. gbValue is True if the package exists on the management server that the unit is connected to, otherwise False.
Boolean. $true if the package exists on the management server that the unit is connected to, otherwise $false. If -mustexist is $true and the package doesn’t exist, the function throws an exception.
Example
Section titled “Example”If bStatus Then bStatus = CMS_ExistPackageOnManagementServer("TestPackage", "v1.0", False)If bStatus And gbValue Then bStatus = Job_WriteLog("Custom", "Package exists", bStatus, True)if (CMS_ExistPackageOnManagementServer 'TestPackage' 'v1.0' $false) { $cs.Job_WriteLog("Exists", "TestPackage exists on the management server")}