Use of variables
Use of variables
In many commands you can use variables - as known from DSM - to keep the script flexible and to be able to react dynamically to situations. Since the Packaging PowerBench generates PowerShell code, we have decided to deviate from the representation of variables known from DSM - namely, enclosing the variable name in percent signs - and use the notation with a leading $ sign known from PowerShell.
Since in this case the end of the variable name is not clearly evident, we enclose the name in curly brackets.
Therefore, to use variables, enter the $ sign in any field of any of the command dialogs, whereupon a drop-down list of known variables is displayed. When you continue writing, the system will suggest the variables that match your input, which you can then accept by pressing TAB, ENTER or clicking with the mouse. To simplify your input, you can do without the opening curly bracket when typing and continue with the first character of the variable name. The PPB recognizes by the $ sign that you want to use a variable and automatically completes the bracket.
Note: You can change the appearance of variables in the configuration file "PackagingPowerBench.exe.config" by entering one of the following values in the "ParameterInputTextMode" entry: "PowerShell", "NiVariable", "SimplePowerShell" (this is the default value), "SimpleDollarOnly". |
Starting with version 3.0 of the Packaging PowerBench, additional variables are available to you, which are retrieved by a variable provider and registered to the system. In principle, this provider is extensible, so that you can also define your own standard variables if you need to. The available variables respectively their values are defined by PowerShell scripts, which are located in the subdirectory Variables of the Common Runtime Files directory. The following four scripts are present here by default:
- ADS.Variables.ps1
Declares Active Directory variables - these have the prefix ADS in the PPB. - CurrentPackage.Variables.ps1
Declares variables describing the properties of the current package - these have the prefix CurrentPackage in the PPB. - Misc.Variables.ps1
Declares various variables - ShellFolders.Variables.ps1
Declares Shell Folders variables - these have the prefix ShellFolders in the PPB.
If required, you can store additional custom scripts here, declare the variables, and then use them in your scripts. It is recommended to use the name prefix "Custom." for your own scripts. The name must end with "Variables.ps1". A valid, meaningful name would therefore be, for example, "Custom.Solys.Variables.ps1".
For a list of available variables, see the Available Variables section in the Appendix.