9.5.11 Executing a search from the command line
This subsection gives the function, format, options, return value, notes about command execution, and an execution example of the jamUserReport command, which executes a search using the created user report.
The executable file for the command is stored in the following folder:
Asset-Console-installation-folder\exe
- Organization of this subsection
(1) Function
The jamUserReport command executes a search using a user report created by the Create User Report job menu. The search result is output to the standard output in the CSV format.
(2) Format
jamUserReport -n "report-name" { [ -cv "variable-name=condition-value" [ -cv "variable-name=condition-value" ] ] | [ -cf "condition-value-definition-file-name" ] } [ -pf "output-file-name" ]
(3) Options
- -n "report-name"
-
Specifies the report name used to execute the search. A report name assigned to multiple reports cannot be specified. This option is mandatory.
- -cv "variable-name=condition-value"
-
Specifies the search condition. The -cv option can specify a condition during a search using a user report. The -cv and -cf options are mutually exclusive. If the specified variable name is undefined or the condition value is omitted, this option is ignored.
- variable-name
-
Specifies the variable name defined on the Command Argument tab in Search condition when a user report was created.
- condition-value
-
Specifies the condition value for the variable. The following describes how to specify the condition value according to the property specified in the search condition:
-
If the property is managed based on its correspondence with code, specify a display name for the condition value, not a numeric value.
-
To specify a date, use the format yyyy/mm/dd or yyyy/mm/dd
hh:mm:ss (
indicates a space).
-
To specify a numeric value, specify a value such as 1000. Do not use commas such as 1,000.
-
For the hardware information Hard disk sizes and Hard disk free space and the device catalog information Hard disk sizes, specify a value in gigabytes. The search result is output in megabytes.
-
For the group information, there is no access permissions depending on the login user, such as in window operations.
-
If the length of a numeric value is predefined, such as an IP address, you can specify as 11.111.111.1 (there is no need to use zeros to adjust the length).
-
- -cf "condition-value-definition-file-name"
-
Specifies the name of the file that defines the condition value (condition value definition file). The -cf and -cv options are mutually exclusive.
The condition value definition file is useful when frequently used search conditions or multiple search conditions are to be combined.
The following shows the format of the condition value definition file:
variable-name,condition-value variable-name,condition-value :
Specify a variable name in column 1 and condition value in column 2, separated by a comma. Create the file in the CSV format.
- -pf "output-file-name"
-
Specifies the name of the search result output file. If you specify a path, the search result is output to the specified folder. If you specify only a file name, the search result is output to the same folder as for the command's executable file, not the standard output.
If the specified output file name already exists, that file is overwritten. If the command terminates with an error, the contents of the existing file are cleared.
(4) Return value
The command returns the following values.
Return value |
Description |
---|---|
0 |
Normal termination |
1 |
Search result contains no item. |
11 |
Processing was cancelled because the specified command option was invalid. |
21 |
Processing was cancelled because the specified report name was invalid. |
22 |
Processing was cancelled because the specified variable name was invalid. |
23 |
Processing was cancelled because the specified condition value was invalid. |
24 |
Processing was cancelled because the specified condition variable value definition file was invalid. |
25 |
Processing was cancelled because the specified output file was invalid. |
31 |
There is not enough memory. |
52 |
Processing was cancelled by the user. |
101 or greater |
The command terminated due to other error. |
(5) Notes during command execution
-
A user with administrator permissions must execute the jamUserReport command.
-
To specify a character string that contains a space in the command's option argument, the entire character string must be enclosed in double quotation marks (").
(6) Execution example
jamUserReport -n "List of Devices" -cv "Variant1=Head Office/IT Management Dept." -pf "C:\kiki.csv"
If you create a batch file (.bat), you can output the search results to a printer by executing the EUR command. The following is an example of a batch file:
jamUserReport -n "List of Devices" -cv "Variant1=Head Office/IT Management Dept." -pf "C:\kiki.csv" IF errorlevel 1 then goto error eurps C:\kiki.fms,C:\kiki.csv IF errorlevel 1 then goto error goto end error: echo Outputting to a printer failed. end: