Command Line for Scripting and Automation

Commvault users can perform backup, restore, and other CommCell operations from the command line. Run these operations individually from the command prompt or combine these operations into a script or third-party application for automation. For example, create a script to trigger a backup whenever a client goes offline and then to restore to a different location.

CommCell operations can be performed through the Command Line Interface (CLI), QScripts, and the Application Programming Interface (QAPI).


Command Line Interface (CLI)

You can run QCommands and XML files from the command line interface to perform CommCell Console operations such as backup and restore. Commvault REST APIs support sending QCommands and XML files as a request. For information, see REST API - POST QCommand.

To run CommCell operations through the command line, you can:

  • Select options from the CommCell Console, click Save As Script to save them as an XML file, and then execute the file from the command prompt.

  • Use the XML templates provided in this documentation for operations that cannot be saved using Save As Script.

  • Execute QCommands to perform other common operations that are not available through XML files.

Use the following table to learn more about the command line operations that are available for each component you want to configure:


Qscripts are pre-defined SQL scripts that enable you to query and, in some cases, directly modify the CommServe database. Each QScript includes a readme file that provides instructions and argument parameters to query the CommServe database. Some QScripts take argument values. For a list of these values, see Command Line - FAQ.

QScripts are pre-defined by the software, so they cannot be modified by end users. You can run QScripts on legacy versions of the software which do not support XML files. However, each QScript can only modify one specific property on the entity.

For more information, see QScripts on the Command Line.

Application Programming Interface (QAPI)

The Application Programming Interface, or QAPI, allows users to create custom commands using C or C++. These customized API applications can be run on Windows and UNIX computers from the CommCell Console or using command line utilities. For more information, see QAPI Developer's Guide.

Documentation Conventions

Command line operations in the documentation observe the following conventions:

  • Bolded Courier New font type is used for all command line arguments.

  • Brackets ([...]) indicate arguments or options that are optional in the command usage description.

  • Italic font type is used to highlight the QCommand operation name in a description.

  • In XML commands, the available XML options are referred to as parameters.