Skip to content

CMS\_GetDeploymentTemplateVariable

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.

:vb: CMS_GetDeploymentTemplateVariable(Section, Variable, MustExist ) As string

:ps: [string]CMS_GetDeploymentTemplateVariable -section <string> -variable <string> -mustexist <bool>

Section (String)

The name of the section in the template

Variable (String)

The name of the variable to return

MustExist (Boolean)

TRUE if the variable must exist

:vb: 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.

:ps: Result will be returned as the result of the function. If the requested section and/or variable is not present then an error is thrown, unless MustExist is set to false.

{
"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"
}]
}

:vb: VBScript

vb<br/>'Variable exists:<br/>If bStatus Then bStatus = CMS_GetDeploymentTemplateVariable("domain", "domainUserName", True)<br/>'This will set bStatus = true, gbValue = true and gsValue = "ciinst"<br/><br/>'Root variable:<br/>If bStatus Then bStatus = CMS_GetDeploymentTemplateVariable("", "title", True)<br/>'This will set bStatus = true, gbValue = true and gsValue = "Default"<br/><br/>'Custom variable:<br/>If bStatus Then bStatus = CMS_GetDeploymentTemplateVariable("CustomValues", "a", True)<br/>'This will set bStatus = true, gbValue = true and gsValue = 1<br/><br/>'bMustExist:<br/>If bStatus Then bStatus = CMS_GetDeploymentTemplateVariable("domain", "publishedAuthority", True)<br/>'This will set bStatus = false, gbValue = false and gsValue = ""<br/><br/>

:ps: Powershell

powershell<br/>$var = CMS_GetDeploymentTemplateVariable -section "domain" -variable "domainUserName' -mustexist $true<br/>#This will set $var = "ciinst"<br/><br/>#Root variable:<br/>$rootvar = CMS_GetDeploymentTemplateVariable -section "" -variable "title" -mustexist $true<br/>#This will set $rootvar = "Default"<br/><br/>#Custom variable:<br/>$custom = CMS_GetDeploymentTemplateVariable -section "CustomValues" -variable "a" -mustexist $true<br/>#This will set $custom = "1"<br/><br/>#bMustExist:<br/>$fail = CMS_GetDeploymentTemplateVariable section "domain" -variable "publishedAuthority" -mustexist $true<br/>#This will throw an exception since 'publishedAuthority' does not exist<br/><br/>

Scripting Guidelines