Use > Application Configuration concepts and tasks > Application Configuration concepts > Running scripts with Application Configurations

Run scripts with Application Configurations

You can add scripts to an Application Configuration that are executed before or after the configuration values are copied to the target server.

For example, you might want to add a Pre-install script that stops an application and a Post-install script that restarts the application after configuration changes have been made. If an error occurs during the push or post-install script, you can run a Post-error script.

Or you might need a Data-manipulation script to handle non-text configuration data. If you are configuring an IIS server, you can use a Data-manipulation script to read the metabase information into a flat file. When the information in the flat file gets parsed with the configuration template, you can run a Post-install script to write the updated information back to the metabase information.

Caution When pushing an application configuration that contains a JScript or VBScript pre-install, post-install or post-error script, the push may succeed even if the script fails. In these cases, the push ignores the script errors. The application configuration does not detect the script failure and allows the push to complete without errors. If you plan to use these types of scripts, you must make sure that the scripts are free of errors and ensure the script returns a non-zero exit status by invoking WScript.Quit(<status>).

Types of Application Configuration scripts

The following table lists the types of scripts you can use in application configuration objects. The script type specifies when the script is invoked. You can define at most one of each script type. If you define a script but do not specify one of these types, that script will be treated like a configuration template. That is, it will be pushed to the server but not executed.

Types of scripts, specifying when the script runs

Script type

Description

Data-manipulation

Runs before any pre-install script and serves the purpose of parsing a non-text configuration file to make it parseable by the CML template. The data-manipulation script is also useful when you only want to scan and import an existing file managed by the application configuration.

If this script fails, the application configuration is not pushed to the server.

Pre-install

Runs before an actual push occurs. For example, a pre-install script could stop an application or service.

If this script fails, the application configuration is not pushed to the server.

Post-install

Runs after the actual push occurs. For example, a post-install script could restart a service after a push.

Post-error

Runs only if the push fails or if the post-install script fails. For example, a post-error script could restore a backed-up file.

To specify the script type:

  1. In the SA Client, open the application configuration object that contains the template.
  2. Select the Configuration Values view to display the templates contained in the application configuration object.
  3. Select the template and right-click to display the menu.
  4. Select the script type, listed in the above table.
  5. Select the File > Save menu.

See also Create a template from a script.

The above table lists the types of scripts you can use in application configuration objects. This type specifies the syntax and execution environment of the script.

Types of script source

Script source type

Description

Windows .BAT script

Windows batch command files.

Windows .JS script

Javascript files running on Windows.

Windows .CMD script

Windows batch command files.

Windows .VBS script

Windows Visual Basic script.

Windows .WSF script

Windows script file.

Windows .PY script

Python file running on Windows.

Unix .SH script

Unix shell scripts.

Other Unix scripts

Any other scripts that run on Unix.

To specify the script type:

  1. In the SA Client, open the template.
  2. Select the Properties view.
  3. In the Type field, select the script type, listed in the above table.
  4. Select the File > Save menu.

See also Create a template from a script.