Kaspersky Standard | Plus | Premium

How to manage tasks using the command line

The following application tasks are provided for managing the Kaspersky application on the command line:

  • File Threat Protection. This task allows you to enable or disable File Threat Protection in real time and defines the settings for the File Threat Protection component. The task starts automatically when the application starts.
  • Malware Scan. This task allows you to scan file system objects for malware on demand and defines the settings for the scan. You can use this task to perform a full or custom scan of the device.
  • Critical Areas Scan. This task allows you to run a critical areas scan of the operating system on demand and defines the settings for the scan.
  • Custom file scan. This task is designed for configuring and storing settings that are used when scanning the specified files and directories using the kfl-control --scan-file command. As a result of the command execution, the application creates and starts a temporary file scan task.
  • Removable Drives Scan. This task allows you to monitor the connection of removable media to the device in real time and defines the settings of the Removable Drives Scan and the scan of its boot sectors for malware.
  • Web Threat Protection. This task allows you to enable or disable Web Threat Protection and defines the settings for the Web Threat Protection component.
  • Behavior Detection. This task allows you to monitor malicious activity of applications in the operating system. The task starts automatically when the Kaspersky application starts.
  • Licensing. This task provides the capability to activate an application installed on the device. The task starts automatically when the application starts, and it resides in the device operating memory. The task has no settings; license keys are managed using special management commands. The task cannot be started, stopped, or deleted.
  • Update. You can use this task to perform scheduled and on-demand application database and module updates and edit update settings.
  • Rollback. You can use this task to roll back the last update of application databases and modules.

Each application task has a name used on the command line, an ID, and a type (see the table below).

IDs are unique for all tasks, including deleted tasks. The application does not reuse the identifiers of the deleted tasks. The identifier of a new task is the next successive number to the identifier of the latest created task.

Task names are not case-sensitive.

During installation of the application, predefined tasks are created. These tasks cannot be deleted. Each predefined task has a name and ID.

Tasks that you create while working with the application are called user tasks. When you create the task, you specify the name for it. IDs for user tasks are defined and assigned by the application when the task is created. IDs for user tasks are starting from 100.

During operation, the application creates temporary scan tasks. Temporary task names and IDs are assigned by the application. Temporary tasks are automatically deleted when completed.

Application tasks

Task

Task name in command line

Task ID

Task type

File Threat Protection

File_Threat_Protection

1

OAS

Malware Scan

Scan_My_Computer

2

ODS

Malware Scan (user task)

user-defined

starting from 100

ODS

Custom file scan

Scan_File

3

ODS

Critical Areas Scan

Critical_Areas_Scan

4

ODS

Update

Update

6

Update

Update (user task)

user-defined

starting from 100

Update

Rollback

Rollback

7

Rollback

Rollback (user task)

user-defined

starting from 100

Rollback

Licensing

License

9

License

Web Threat Protection

Web_Threat_Protection

14

WTP

Removable Drives Scan

Removable_Drives_Scan

16

RDS

Behavior Detection

Behavior_Detection

20

BehaviorDetection

You can perform the following actions with tasks:

In this section

How to view the list of tasks on the command line

How to view the status of a task on the command line

How to create a task on the command line

How to start, stop, pause, and resume a task on the command line

How to delete a task on the command line

How to output task settings to the console or into a configuration file

Page top
[Topic 287132]

How to view the list of tasks on the command line

To view the list of application tasks, execute the following command:

kfl-control --get-task-list [--json]

where:

--json – output format for the list of application tasks. If a file format is not specified, the output will be an INI file.

The list of Kaspersky tasks is displayed.

The following information will be displayed for each task:

  • Name: the task name
  • ID: the task ID
  • Type: the task type
  • State: the current state of the task
Page top
[Topic 287604]

How to view the status of a task on the command line

To view a task state, execute the following command:

kesl-control --get-task-state <task ID/name> [--json]

where:

  • <task ID/name> is the ID assigned to the task at the time of its creation, or the name of the task in the command line.
  • --json is specified to output the settings in JSON format.

Application tasks can take the following main states:

  • Started—Task is running.
  • Starting—Task is being launched.
  • Stopped—Task has been stopped.
  • Stopping—Task is stopping.

ODS tasks can also have one of the following states:

  • Pausing — Task is pausing.
  • Suspended — Task is suspended.
  • Resuming — Task is resuming.

Page top

[Topic 290083]

How to create a task on the command line

You can create tasks of the following types: ODS, Update, and Rollback.

You can create tasks with default settings or with settings specified in a configuration file.

To create a task with default settings, execute the following command:

kfl-control --create-task <task name> --type <task type>

where:

  • <task name> is the name that you specify for the new task.
  • <task type> is the identifier for the type of the created task.

To create a task with the settings specified in the configuration file, execute the following command:

kfl-control --create-task <task name> --type <task type> --file <configuration file path> [--json]

where:

  • <task name> is the name that you specify for the new task.
  • <task type> is the identifier for the type of the created task.
  • <path to file> is the full path to the configuration file with the settings that will be used for creating the task.
  • --json is specified to import the settings from the configuration file in JSON format. If the --json option is not specified, the application attempts to import from an INI file. If the import fails, an error is displayed.

Page top

[Topic 287579]

How to start, stop, pause, and resume a task on the command line

You can start and stop predefined and user tasks, except for tasks of the License type.

You can pause and resume ODS tasks.

To start a task, execute the following command:

kfl-control --start-task <task ID/name> [-W] [--progress]

where:

  • <task ID/name> is the ID assigned to the task at the time of its creation, or the name of the task in the command line.
  • [-W] is a command used in conjunction with the task start command to enable the display of current events associated with this task.
  • Specify the [--progress] option if you want to display the progress of the task.

    Example:

    Start the task with ID 1 and enable the display of current events associated with the task:

    kfl-control --start-task 1 -W

To stop a task, execute the following command:

kfl-control --stop-task <task ID/name> [-W]

where:

  • <task ID/name> is the ID assigned to the task at the time of its creation, or the name of the task in the command line.
  • [-W] is a command used in conjunction with the stop task command to enable the display of current events associated with this task.

To suspend a task, execute the following command:

kfl-control --suspend-task <task ID/name>

To resume a task, execute the following command:

kfl-control --resume-task <task ID/name>

Page top

[Topic 290084]

How to delete a task on the command line

You can delete only user tasks. Predefined tasks cannot be deleted.

To delete a task, execute the following command:

kfl-control --delete-task <task ID/name>

where <task ID/name> is the ID assigned to the task at the time of its creation, or the name of the task in the command line.

Page top
[Topic 290441]

How to output task settings to the console or into a configuration file

You can display the current values of settings for all user tasks and all predefined tasks, except for Rollback and License tasks (these tasks have no settings).

You can output the current values of task settings to the console or to a configuration file that you can use to change task settings.

To output the current values of task settings to the console, execute the following command:

kfl-control --get-settings <task ID/name> [--json]

where:

  • <task ID/name> is the ID assigned to the task at the time of its creation, or the name of the task in the command line.
  • --json is specified to output the settings in JSON format. If the --json option is not specified, the settings are output in the INI format.

To output the current values of task settings to a configuration file, execute the following command:

kfl-control --get-settings <task ID/name> --file <configuration file path> [--json]

where:

  • <task ID/name> is the ID assigned to the task at the time of its creation, or the name of the task in the command line.
  • --file <configuration file path> is the path to the configuration file into which the task settings will be written. If you specify the name of a file without its path, the file will be created in the current directory. If a file already exists in the specified path, it will be overwritten. If the specified directory does not exist, the configuration file will not be created.
  • --json is specified to output the settings in JSON format. If the --json option is not specified, the settings are output in the INI format.
Page top
[Topic 290442]