CMS_GetDeploymentTemplateVariable
Description
Section titled “Description”Returns a variable from the deployment template from which the client was installed. Alternatively, the template is fetched from the business unit that the client was linked to at installation time.
Syntax
Section titled “Syntax”CMS_GetDeploymentTemplateVariable(Section, Variable, MustExist) As Boolean[string] CMS_GetDeploymentTemplateVariable -section <string> -variable <string> -mustexist <bool>Parameters
Section titled “Parameters”Section (String)
Section titled “Section (String)”The name of the section in the template. Use an empty string ("") for a variable at the root of the template, and CustomValues for a custom value. Section and variable names aren’t case-sensitive.
Variable (String)
Section titled “Variable (String)”The name of the variable to return
MustExist (Boolean)
Section titled “MustExist (Boolean)”TRUE if the variable must exist
Return value
Section titled “Return value”The function returns a boolean, indicating if the call was successful. If the requested section and/or variable is not present, then false is returned, unless MustExist is set to false. The requested value will be stored in gsValue. If the variable can be read, then gbValue will be set to TRUE, otherwise, it will be set to FALSE.
The value of the variable as a string. If the requested section and/or variable is not present and -mustexist is $true, the function throws an exception.
Example configuration
Section titled “Example configuration”{ "operatingSystem": { "ImageId": 13, "diskConfigId": 1, "localAdmin": "true", "password": "15aarest" }, "domain": { "joinDomain": "CAPADEMO.LOCAL", "domainName": "CAPADEMO.LOCAL", "domainUserName": "ciinst", "domainUserPassword": "dftgyhuj", "computerObjectOU": "OU=Computers,OU=Lazise,OU=Dev2,DC=CAPADEMO,DC=local"}, "title": "Default", "customValues": [{ "key": "a", "value": "1" }]}Example
Section titled “Example”'Variable exists:If bStatus Then bStatus = CMS_GetDeploymentTemplateVariable("domain", "domainUserName", True)'This will set bStatus = true, gbValue = true and gsValue = "ciinst"
'Root variable:If bStatus Then bStatus = CMS_GetDeploymentTemplateVariable("", "title", True)'This will set bStatus = true, gbValue = true and gsValue = "Default"
'Custom variable:If bStatus Then bStatus = CMS_GetDeploymentTemplateVariable("CustomValues", "a", True)'This will set bStatus = true, gbValue = true and gsValue = 1
'bMustExist:If bStatus Then bStatus = CMS_GetDeploymentTemplateVariable("domain", "publishedAuthority", True)'This will set bStatus = false, gbValue = false and gsValue = ""$var = CMS_GetDeploymentTemplateVariable -section "domain" -variable "domainUserName" -mustexist $true#This will set $var = "ciinst"
#Root variable:$rootvar = CMS_GetDeploymentTemplateVariable -section "" -variable "title" -mustexist $true#This will set $rootvar = "Default"
#Custom variable:$custom = CMS_GetDeploymentTemplateVariable -section "CustomValues" -variable "a" -mustexist $true#This will set $custom = "1"
#bMustExist:$fail = CMS_GetDeploymentTemplateVariable -section "domain" -variable "publishedAuthority" -mustexist $true#This will throw an exception since 'publishedAuthority' does not exist