Product Documentation

Use named parameters in scripts

Important: This topic describes deprecated functions and will be removed from the documentation. For more information about deprecated functions in Smart Tools, see What’s New in Citrix Smart Tools.

If your script supports named parameters, you can reference parameters by name in your script. The key-value pairs that you specify are passed to the script at runtime.

Note: Named parameters are supported only in PowerShell scripts.

This walkthrough demonstrates how to use named parameters within a simple PowerShell (ps1) script.

Step 1: Create a script

  1. From the menu bar, click Smart Build.
  2. Click New Script.
  3. Enter the name of the script as Named Parameters.
  4. Enter Type (File Ext) as ps1 and click Next.
  5. Enter the following PowerShell code in the script source editor and click Next:

  6. Under Script Parameters, select Use named parameters.
  7. Enter the following parameters:

    Type Key Value
    String Computer
    String Filepath C:\Users\acme\weekly-status

    The image below shows these entries as they would appear in the script editor: Script parameters in Blueprint Designer with Named Parameters checkbox selected

  8. Click Next and click Finish.

Step 2: Run the script on a machine

  1. From the menu bar, click Smart Build.
  2. Move the pointer over the script and select Actions > Deploy.
  3. Provide a job name, select a machine, and click Next.
  4. Select Run Now and click Next.
  5. Review the parameters and click Next.
  6. Click Finish. The script job runs and a status notification is sent to your registered email address.

Step 3: View job details

  1. From the menu bar, click Smart Build.
  2. Move the pointer over the script and select Actions > View.
  3. Click View Jobs.
  4. Under Instances, click the job name.
  5. Under Runs, click the run instance. Step details appear.
  6. Click the Step Output tab. Step results appear.

A workflow summary including the key-value pairs, and the script output is illustrated in the following image:

Diagram of parameter processing to achieve result output

Use named parameters in scripts