How to use the "cspquery.bat" script to run queries or generate reports in the Command Line Interface (CLI)

Article:TECH170860  |  Created: 2011-09-30  |  Updated: 2011-10-13  |  Article URL http://www.symantec.com/docs/TECH170860
Article Type
Technical Solution


Issue



How to use the Symantec Critical System Protection (SCSP) cspquery.bat script to run queries or generate reports in the CLI


Environment



All released SCSP versions


Solution



 The command line to run cspquery.bat as shown below:

 c:\Program Files\Symantec\Critical System Protection\Console\cspquery.bat -u <username_to_login_console> -p <passwd_to_login_console>  -q <config_file> -s <IP_ADDR_of_CSP_Server>

Generally,

where the <username_to_login_console> is "symadmin" ;

The <passwd_to_login_console> is the password which should match with "symadmin" to login to the console;

The <config_file> is the template configuration file for the CLI query execution for the SCSP console;

The -s argument is used to point the SCSP server IP or hostname;

To make sure the script returns the correct result, the <config_file> parameters must be properly configured. The cspquery.bat script reads the arguments from the <config_file>. SCSP embeds a template file in c:\program files\symantec\critical system protection\console\query_template.ini as reference.

The new <config_file> may be based on this template. To make sure the script runs properly, it`s important to pay close attention to the scope of the file (below):

[Source]

This section describes which query or report to run; the required parameter is type and path.

The "Type" parameter used to define the action what taken by the script, there are two types, "query" or "report"

The "path" parameter used to point the path and name of the report or query. To define a report or query, Please follow below steps:

1. Login to the console

2. Click the "report" button in the left pane ->click the "queries" folder in the middle pane->expand the default folder named "Symantec"->then choose the pre-defined query -> right click the policy and click "export query"-> to export the query to a folder

3. Click the "report" button in the left pane ->Right click the "queries" folder in the middle pane and click the "new folder"-> then create a custom folder (i.e., "Michael", etc.)  as the container to import the query file->then right click the custom folder and choose "import query"-> import the query which you exported in prior procedure->then rename it (such as "test") to be referenced in the config_file.

4. Then set the path as path=Queries/michael/test

[Action]

This section describes the action to be taken.

Two actions should be included: "publish" or "export"

To get more information , please refer to the comments of file c:\program files\Symantec\critical system protection\console\query_template.ini.

Essentially,  The file appears as below:

action=export

file=c:\myreport.pdf

then run :

c:\Program Files\Symantec\Critical System Protection\Console\cspquery.bat -u symadmin -p <passwd_to_login_console>  -q  C:\Program Files\Symantec\Critical System Protection\Console\query_config_file.ini  -s 127.0.0.1

The "myreport.pdf" file will be created under C:\. Please note that the exported file will not exist, and you must have permission to create it. 

You can also define other actions and file types in the <config_file>.

 

 




Article URL http://www.symantec.com/docs/TECH170860


Terms of use for this information are found in Legal Notices