This page has moved to docs.citrix.com. You can now find all Smart Tools documentation at the Citrix Product Documentation site. Please update any page links to the new URL: https://docs.citrix.com/en-us/smart-tools/smart-build/about-scripts.html.
- Where are my scripts located?
- How do I add a script to my library?
- Which scripts does Smart Tools support?
- Can I test my scripts with Smart Tools?
- Can I share my scripts with other users?
Using scripts you can automate tasks and improve productivity. Citrix Smart Tools enables you to create scripts with all the required script data. You can write your scripts directly during the script creation process or drag and drop pre-existing scripts from your local machine to the code editor. You can specify default values for script parameters. Values defined for parameters are saved and passed to the script at runtime.
You can create scripts to automate tasks including:
- Installing software
- Backing up servers
- Rotating logs
- Configuring infrastructure
- Monitoring resources
- Cleaning filesystems
- Managing users
Where are my scripts located?
All scripts and blueprints that you create are stored in your library. If you are a user of multiple Smart Tools accounts, you have a separate library for each account. For more information, see About the Library.
How do I add a script to my library?
Use the script editor to create a new script. From your library, simply click New Script. For more information, see Add a new script.
The script editor includes the following tabs:
- Script: Use this tab to enter your script in the code editor.
- Parameters: Use this tab to enter variables and values that need to be passed when the script is executed. You can also add tooltips to help blueprint users understand the intent of each parameter and input the right values, if applicable.
- Attachments: Use this tab to execute any companion files on the target server. For example, if a step in your blueprint requires that a ZIP utility be present on the target server, you can create an installation script and add the executable file as an attachment. You can then add the installation script as a step in your blueprint or deploy the script to the target server separately.
Which scripts does Smart Tools support?
Smart Tools does not execute the scripts you add to blueprints, so it does not need to support any specific script types. When you deploy a script through Smart Tools (typically as part of a larger blueprint), Smart Tools copies the script to the target server where it is executed. Therefore, the target server must have the correct script interpreter prior to deploying the script. Some interpreters are integrated into certain operating systems, so the interpreter for your script might reside already on the target server (for example, PowerShell or .NET on Windows servers). However, other interpreters might need to be installed, which might require an added step in your blueprint. Before deploying your script, verify the target server has the correct interpreter for executing your script successfully.
Can I test my scripts with Smart Tools?
You cannot test or "preview" your scripts from within Smart Tools. You can only use Smart Tools to add scripts using the script editor, deploy scripts, or add scripts to blueprints. To validate your script and ensure it performs as expected before you deploy it or use it in a blueprint, execute your script in a test environment that includes a machine similar to your target machine prior to deploying with Smart Tools.
Important: Smart Tools does not validate the parameters you include in scripts, including PowerShell scripts. When the script is deployed, any validation errors that occur are not flagged by Smart Tools. As a result, Smart Tools might report the script deployment as successful even though the script actually failed. To mitigate this issue, you will need to include appropriate error handlers in your script code so Smart Tools can interpret script failures. For example, you can program your script to exit with an error message in case of a script failure.
Can I share my scripts with other users?
Yes, you can share the scripts in your library with other users of your own Smart Tools account. However, you cannot share scripts with users of different Smart Tools accounts. For more information, see About sharing blueprints and scripts.