Deployment on Server Core

This article contains information on how to deploy CodeTwo Exchange Rules on the Server Core version of Windows Server. The program needs to be deployed on an Exchange server with the Mailbox server role installed. Since Server Core has no graphical user interface (GUI), only the basic components of CodeTwo Exchange Rules, necessary to relay emails through the program, are installed. This means that to configure and manage email rules, edit program settings, or use other features of the program, you need to install the Administration Panel of CodeTwo Exchange Rules, which requires a GUI to be managed. The Administration Panel needs to be installed on a client machine (not Core) from a standard EXE installer. For instructions on how to perform a standard installation of CodeTwo Exchange Rules, refer to this article.

Important

The installation of CodeTwo Exchange Rules on Server Core is supported only for those versions of the program that work with Exchange Servers that can be deployed on Windows Server Core.

Follow the links below to learn how to:

How to install CodeTwo Exchange Rules on Server Core

Follow the steps below to install the software on the Server Core version of Windows Server. As a result, the following components will be installed on Server Core:

  • CodeTwo Exchange Rules services:
    • CodeTwo Exchange Rules Attendant
    • CodeTwo Exchange Rules Service (Engine)
    • CodeTwo Exchange Rules Sent Items Update
  • CodeTwo Exchange Rules transport agent
  • the licensing module. 
  1. Run the Command Prompt (cmd.exe).
  2. In the Command Prompt, in order to install CodeTwo Exchange Rules services, run the program's .msi installer with the following parameters:

    Important

    The .msi file name differs depending on the program you want to install. For example, the name of the .msi file for CodeTwo Exchange Rules 2019 is ExchangeRules2019SetupEN.msi.

    • /quiet
    • ACTION="INSTALL"
    • EXCHANGE_VERSION="<value>" – this parameter determines the version of Exchange server that is installed on your machine. The value can be, for example: 2019
    • CORE="1" – this parameter determines a Server-Core-specific installation of CodeTwo Exchange Rules. Setting the value to 1 will install a version of CodeTwo Exchange Rules that is compatible with Server Core
    • INSTALLDIR="<installation_dir_path>" – this parameter is optional. The default installation directory of CodeTwo Exchange Rules is: C:\Program Files\CodeTwo\CodeTwo Exchange Rules. You can change the installation location by typing a different path as the parameter value.

      Example command line for installing CodeTwo Exchange Rules 2019:
      ExchangeRules2019SetupEN.msi /quiet ACTION="INSTALL" EXCHANGE_VERSION="2019" CORE="1"
  3. In the PowerShell Console, navigate to the installation directory of CodeTwo Exchange Rules, where the InstallCodeTwoTransportAgent.ps1 script is located. This script performs the following actions:

    • stops the CodeTwo Exchange Rules and MSExchangeTransport services,
    • installs and enables the CodeTwo Exchange Rules transport agent,
    • starts the CodeTwo Exchange Rules and MSExchangeTransport services.
  4. Run the InstallCodeTwoTransportAgent.ps1 script to install the CodeTwo Exchange Rules transport agent. If for some reason you cannot run the CodeTwo Exchange Rules transport agent's installation script, you can install the transport agent manually. To do so, follow the steps described in section How to install the CodeTwo Exchange Rules transport agent manually on Server Core.

To verify if the CodeTwo Exchange Rules services were installed correctly, perform the steps described below.

  1. Launch the PowerShell Console and run the command:

    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
  2. Run the command:
    Get-Service "CodeTwo Exchange Rules*"
    This command should return the following services: CodeTwo Exchange Rules Attendant, CodeTwo Exchange Rules Engine (CodeTwo Exchange Rules Service), CodeTwo Exchange Rules SentItemsUpdate. Each of them should be active, i.e. their status should show Running (Fig. 1.).

    Exchange Rules Core installation - services
    Fig. 1. A list of installed CodeTwo Exchange Rules services.

  3. Run the command:
    Get-TransportAgent
    This command returns a list of installed transport agents. You should see the CodeTwo Exchange Rules transport agent at the bottom of the list (Fig. 2.). This transport agent should be enabled (Enabled = True).

    Exchange Rules Core installation - transport agent
    Fig. 2. Verifying that the CodeTwo ExchangeRules transport agent has been installed.

How to uninstall CodeTwo Exchange Rules from Server Core

Important

To be able to perform the steps described below, you need to use the same .msi file that was used to install the program. An .msi file of a different version of CodeTwo Exchange Rules will not work.

If you don't have the relevant file any longer, perform these steps instead. 

  1. In the PowerShell Console, navigate to the installation directory of CodeTwo Exchange Rules, where the UninstallCodeTwoTransportAgent.ps1 script is located (by default, the program is installed in: C:\Program Files\CodeTwo\CodeTwo Exchange Rules). This script performs the following actions:
    • stops the CodeTwo Exchange Rules services and MSExchangeTransport services,
    • uninstalls the CodeTwo Exchange Rules transport agent,
    • starts the CodeTwo Exchange Rules services and MSExchangeTransport services.
  2. Run the UninstallCodeTwoTransportAgent.ps1 script to uninstall the CodeTwo Exchange Rules transport agent. If for some reason you cannot run the CodeTwo Exchange Rules transport agent's uninstallation script, you can uninstall the transport agent manually. To do so, follow the steps described in section How to uninstall the CodeTwo Exchange Rules transport agent manually from Server Core.
  3. Run the Command Prompt (cmd.exe).
  4. In the Command Prompt, in order to uninstall CodeTwo Exchange Rules services, run the program's .msi installer with the following parameters:
    • /quiet
    • REMOVE="ALL"
    • EXCHANGE_VERSION="<value>" – this parameter determines the version of Exchange server that is installed on your machine. The value can be, for example: 2019
    • CORE="1" – this parameter determines a Server-Core-specific installation of CodeTwo Exchange Rules. Value 1 is used when uninstalling a version of CodeTwo Exchange Rules that is compatible with Server Core.

      Example command line for uninstalling CodeTwo Exchange Rules 2019:
      ExchangeRules2019SetupEN.msi /quiet REMOVE="ALL" EXCHANGE_VERSION="2019" CORE="1"

In order to verify if CodeTwo Exchange Rules services were uninstalled successfully, perform the steps described below.

  1. Launch the PowerShell Console and run the command:
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
  2. In the PowerShell Console, run the command:
    Get-Service "CodeTwo Exchange Rules*"
    This command should not return any services.
  3. Run the command:
    Get-TransportAgent
    This command returns a list of installed transport agents. The CodeTwo Exchange Rules transport agent should not be listed.

Uninstall CodeTwo Exchange Rules by using the Windows Management Instrumentation (WMI) utility

This is an alternative method of uninstalling CodeTwo Exchange Rules from Server Core, which doesn't require the original .msi file that was used to install the program.

  1. In the Command Prompt, type
    wmic
    and press Enter. This will display the wmic:root\cli> prompt.
  2. Run the command:
    product where name="<product name>" call uninstall
    Where <product name> is the exact name of the CodeTwo Exchange Rules product that you installed, e.g. CodeTwo Exchange Rules 2019 (see Fig. 3.). Type y to confirm the uninstall process. 

You should get the following information after the program is successfully uninstalled (Fig. 3.):

Method Execution Successful.
Out Parameters:
instance of _PARAMETERS
{
        ReturnValue = 0;
};

Exchange Rules 2019 Core installation - WMI
Fig. 3. Uninstalling CodeTwo Exchange Rules 2019 by using Windows Management Instrumentation.

How to update the Server Core version of CodeTwo Exchange Rules

Before you install the latest version of the program, you need to uninstall the existing version. Perform the steps described in section How to uninstall CodeTwo Exchange Rules from Server Core using the .msi file that contains the installation data of the currently deployed version of CodeTwo Exchange Rules. Next, perform the steps described in section How to install CodeTwo Exchange Rules on Server Core using the .msi file of the newer version of the program. All settings will be retained. If the CodeTwo Exchange Rules services are also installed on other servers in your organization, you need to update them on each server. Refer to this article for steps on how to perform an update of CodeTwo Exchange Rules in a non-Core environment.

How to install the CodeTwo Exchange Rules transport agent manually on Server Core

If for some reason you cannot run the CodeTwo Exchange Rules transport agent's installation script, you can install the transport agent manually by following these steps:

  1. Launch the PowerShell Console and run the command:
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
  2. Stop the MSExchangeTransport service by running the command:
    Stop-Service "MSExchangeTransport"
  3. Stop all installed CodeTwo Exchange Rules services by running the command:
    Stop-Service "CodeTwo Exchange Rules*"
  4. In the PowerShell Console, navigate to the installation directory of CodeTwo Exchange Rules. By default, the program is installed in: C:\Program Files\CodeTwo\CodeTwo Exchange Rules.
  5. Get an absolute path to the CodeTwo.ER.Agent.dll file by running the command:
    $CodeTwoAgentAssemblyPath = Resolve-Path -Path CodeTwo.ER.Agent.dll
  6. Install the CodeTwo Exchange Rules transport agent by running the command:
    Install-TransportAgent -Name "CodeTwo Exchange Rules" -AssemblyPath $CodeTwoAgentAssemblyPath -TransportAgentFactory "Agent.CAgentFactoryRouting"
  7. Enable the installed transport agent by running the command:
    Enable-TransportAgent -Identity "CodeTwo Exchange Rules"
  8. Start the MSExchangeTransport service by running the command:
    Start-Service "MSExchangeTransport"
  9. Start all installed CodeTwo Exchange Rules services by running the command:
    Start-Service "CodeTwo Exchange Rules*"

How to uninstall the CodeTwo Exchange Rules transport agent manually from Server Core

If for some reason you cannot run the CodeTwo Exchange Rules transport agent's uninstallation script, you can uninstall the transport agent manually by following these steps:

  1. Launch the PowerShell Console and run the command:
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
  2. Stop the MSExchangeTransport service by running the command:
    Stop-Service "MSExchangeTransport"
  3. Stop all installed CodeTwo Exchange Rules services by running the command:
    Stop-Service "CodeTwo Exchange Rules*"
  4. Uninstall the CodeTwo Exchange Rules transport agent by running the command:
    Uninstall-TransportAgent -Identity "CodeTwo Exchange Rules" -Confirm:$false
  5. Start the MSExchangeTransport service by running the command:
    Start-Service "MSExchangeTransport"
  6. Start all installed CodeTwo Exchange Rules services by running the command:
    Start-Service "CodeTwo Exchange Rules*"

Was this information useful?