## Command Line Interface

The BEA Guardian Command Line Interface is accessed with a Windows Command Prompt window or a Linux terminal window. The Guardian command interpreter is an executable .cmd batch file for Windows, and a .sh shell script for Linux. Both the Windows batch file and the Linux shell script are wrappers that accumulate and organize arguments to the Java command.

To use the Guardian Command Line Interface, run the guardianHeadless.cmd (for Windows) or guardianHeadless.sh (for Linux) executable file which was placed in the installation directory you specified when you installed Guardian.

If you have not previously set your Guardian Workspace location when starting the Graphical User Interface, the Guardian Command Line Interface will use a default Guardian Workspace location, unless you specify otherwise in each command. The default Guardian Workspace location is in your home directory; for example, C:\Documents and Settings\<username>\guardianWorkspace for Windows, and /home/<username>/guardianWorkspace for Linux. If you have previously set your Guardian Workspace location, the Guardian Command Line Interface will use that location for all its operations, unless you specify otherwise in each command. Identifying the Guardian Workspace location is essential for accessing the correct set of active domains, Domain Inventories, and Evaluation Summaries.

The Guardian Command Line Interface accepts a variety of commands that perform almost every task available with the Graphical User Interface. To see a list of the commands available and their syntax, type guardianHeadless -ghelp at the operating system command prompt. Please note that the Guardian Command Line Interface commands are case sensitive.

The output of each command is not sent to the console window. Instead, it is sent to the output file, headless_output.txt. The output file created in your current directory, and is overwritten each time you run it.

Also note that each command must have a prefix of `-g`, as shown in the examples below. Please pay special attention to the spacing, the arguments that require quotes, and the case sensitivity.

Examples:

- guardianHeadless.cmd -glistActiveDomains
- guardianHeadless.cmd -gactivateDomain -t http://localhost:9116 -u un -p pw -c true -data "D:\MyData\Guardian Data Directories\Installer-2079"
- guardianHeadless.cmd -gcreateShortcut -d Naxos_localhost_9116 -b 2
- guardianHeadless.cmd -gdeleteShortcut -s "Security Advisories in Naxos"

The following table describes each Guardian command. After that is a syntax description for each command.

Command | What It Does
activateDomain | Activates the domain specified to prepare it for evaluation and returns the domain identifier.
createShortcut | Creates a shortcut for the domain and bundle specified to save keystrokes in conducting evaluations.
deactivateDomain | Removes the domain specified from evaluation eligibility.
deleteShortcut | Deletes the shortcut specified.
evaluateDomainBundle | Evaluates the domain and bundle specified. Use the Graphical User Interface to see the evaluation results.
evaluateShortcut | Evaluates the domain and bundle associated with the shortcut specified. Use the Graphical User Interface to see the evaluation results.
help | Displays usage information.
listActiveDomains | Lists the active domains available for evaluation in domain identifier format.
listBundles | Lists the bundle identifier and bundle name of the bundles available for evaluation.
listShortcuts | Lists the shortcuts available for evaluation.
script | Executes the commands contained in the script file specified.

The following list gives the syntax for each command that accepts arguments. Optional parameters are enclosed in square brackets:

- activateDomain -t targetUrl -u username -p password [ -c persistCredentials ] [ -data workspaceDir ]

- targetUrl: the http://listen-address:port-number format address of the domain's administration server (not in quotes)
- username: administrator account username for the specified domain
- password: administrator account password for the specified domain
- persistCredentials (true or false, without quotes): whether to persist the username and password in encrypted form (default = false)
- workspaceDir: the full directory specification, in quotes, of the location of the Guardian Workspace

- createShortcut -d domainId [ -b bundleId ] [ -s shortcutName ] [ -data workspaceDir ]

- domainId: the domain identifier for the shortcut
- bundleId: the bundle identifier for the shortcut (default = 0, which is the identifier for the bundle named, "Default Signatures"). The values for all the bundles can be found with the listBundles command.
- shortcutName: the name of the shortcut in quotes (default = "<bundle name> in <domain name>")
- workspaceDir: the full directory specification, in quotes, of the location of the Guardian Workspace

- deactivateDomain -d domainId [ -l deleteUserData ] [ -data workspaceDir ]

- domainId: the domain identifier of the domain to deactivate
- deleteUserData (true or false, without quotes): whether to delete the Domain Inventories and Evaluation Summaries from the Guardian Workspace (default = false)
- workspaceDir: the full directory specification, in quotes, of the location of the Guardian Workspace

- deleteShortcut -s shortcutName [ -data workspaceDir ]

- shortcutName: the name of the shortcut to delete, in quotes, as shown with the listShortcuts command.
- workspaceDir: the full directory specification, in quotes, of the location of the Guardian Workspace

- evaluateDomainBundle -d domainId [ -b bundleId ] [ -u username -p password ] [ -c persistCredentials ] [ -data workspaceDir ]

- domainId: the domain identifier of the domain to evaluate
- bundleId: the bundle identifier for the shortcut (default = 0, which is the identifier for the bundle named, "Default Signatures"). The values for all the bundles can be found with the listBundles command.
- username: administrator account username for the specified domain (not required if persistCredentials set to true in activateDomain)
- password: administrator account password for the specified domain (not required if persistCredentials set to true in activateDomain)
- persistCredentials (true or false, without quotes): whether to persist the username and password in encrypted form (default = false)
- workspaceDir: the full directory specification, in quotes, of the location of the Guardian Workspace

- evaluateShortcut -s shortcutName [ -u username -p password ] [ -c persistCredentials ] [ -data workspaceDir ]

- shortcutName: the name of the shortcut to evaluate in quotes
- username: administrator account username for the specified domain (not required if persistCredentials set to true in activateDomain)
- password: administrator account password for the specified domain (not required if persistCredentials set to true in activateDomain)
- persistCredentials (true or false, without quotes): whether to persist the username and password in encrypted form (default = false)
- workspaceDir: the full directory specification, in quotes, of the location of the Guardian Workspace

- help
- listActiveDomains [ -data workspaceDir ]

- workspaceDir: the full directory specification, in quotes, of the location of the Guardian Workspace

- listBundles [ -data workspaceDir ]

- workspaceDir: the full directory specification, in quotes, of the location of the Guardian Workspace

- listShortcuts [ -data workspaceDir ]

- workspaceDir: the full directory specification, in quotes, of the location of the Guardian Workspace

- script -f scriptname [ -data workspaceDir ]

- scriptname: the name of a script file containing Guardian commands. Each command has to be on a separate line. See Running Scripts for more information.
- workspaceDir: the full directory specification, in quotes, of the location of the Guardian Workspace