Kaspersky Security 9.x for Microsoft Exchange Servers

Script operation modes

April 2, 2024

ID 71970

The Microsoft Exchange Web Services Managed API 2.0 program interface is required to run the script intended for sending spam for research. Download the software module of this interface by clicking the following link: http://www.microsoft.com/en-us/download/details.aspx?id=35371 and store it in the bin subfolder of the folder containing the script.

The script works in one of the two modes:

  • Permission assignment mode
  • Ordinary mode

Permission assignment mode

In the permission assignment mode, the script assigns mailbox access permissions to the user under whose account the script will be executed subsequently. You have to execute the script in this mode before you use it for the first time, as well as every time after adding new mailboxes to the configuration file.

Mailboxes for which rights have been assigned are marked with a special attribute in the configuration file. They are not processed by the script any time it runs in this mode.

You can reset privileges assigned by the script manually.

To reset permissions assigned by the script manually:

  1. Open the user's mailbox in Microsoft Outlook.
  2. Open the context menu of the Junk Email folder.
  3. Select Properties.
  4. On the Permissions tab of the properties window of the Junk Email folder, delete the entry linked to the user account under which the script is running.
  5. Click OK.
  6. Open the configuration file of the script.
  7. In the <users> section, delete the entry linked to the user's mailbox.

    If you plan to stop processing spam messages from this mailbox, simply remove the rightsAssigned attribute from the entry in the configuration file. This will exclude the mailbox from processing until the script is executed in permission assignment mode again or until the rightsAssigned attribute is reset.

In permission assignment mode, the script is executed in Exchange Management Shell on behalf of the user with privileges to edit permissions in mailboxes of users.

The script requires Windows PowerShell version 2.0 or later.

Ordinary script operation mode

In this mode, the script selects spam messages one at a time from the Junk Email folder of users' mailboxes specified in the <users> section of the configuration file and for which the relevant rights have been assigned.

The following selection criteria are used:

  • The message is not a non-delivery report (NDR)
  • The message is not older than the number of days specified using the <oldMessages> parameter of the configuration file
  • The "Subject" field of the message does not contain tags specified in the <subjectMarks> section of the configuration file

Every such spam message added to the email as an attachment, with the internal structure of the spam message retained, and sent to the email address specified using the <recipientEmail> parameter of the configuration file. After that, the tag with the default attribute in the configuration file is added to the "Subject" field of the message.

This process is repeated for all mailboxes specified in the <users> section of the configuration file.

For the script to be executed continuously, use the tools of your operating system to create a scheduled task.

Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.