Skip to the main content.

ScriptRunner Blog

How to set up the Action Pack for Exchange in just 3 steps

Table of Contents

Post Featured Image

Even in Exchange Teams there are many routine tasks to be done every day. With ScriptRunner ActionPack for Exchange, these tasks can be automated and delegated quickly and securely.


Only 3 steps are necessary to use the scripts from the ActionPack for Exchange in ScriptRunner:

  1. Importing ActionPack scripts in ScriptRunner
  2. Configuring Exchange Server as target system with administrative access
  3. Checking connection to Exchange Server

Actions can then be set up and delegated using the scripts from the collection.

 

Step 1: Importing ActionPack scripts in ScriptRunner

The ScriptRunner ActionPacks are made available on the ScriptRunner GitHub repository, and more scripts and topics are added and updated regularly.

There are several ways to include the scripts from the ActionPacks in ScriptRunner. According to best practice, an alternative directory is created for the Sync Script. This way the scripts are always available internally on the latest version.

The scripts to be used can be migrated to the working directory manually or by action with an appropriate ScriptRunner script.

This is how you connect ScriptRunner to the Github repository for the first time:

  1. Install Git for Windows on the ScriptRunner host. You can find instructions on GitHub
  2. Download Sync Script from GitHub.
  3. Load Sync Script to the script repository on the ScriptRunner host as well as create a GitHub user under Credentials.
  4. Set up a GitSync action on ScriptRunner for “Clone” mode and run it for the first time. The ActionPacks are created in the specified directory.

Update scripts:

Configure a scheduled action with “Pull”-mode. This will automatically update the scripts in the specified target directory.

To make the ActionPack for Exchange available for actions:

Copy the desired scripts or the entire directory of an ActionPack into the ScriptRunner working directory. The scripts will be automatically recognized and tagged by ScriptRunner. Now the scripts are available in ScriptRunner.

 

Step 2: Configuring Exchange Server with Credentials

To use the scripts from the ActionPack for Exchange in ScriptRunner, you first need to set up an Exchange administration account and the Exchange Server in ScriptRunner. These steps are done in the ScriptRunner Admin App.

Creating the Exchange administrative account:

The Exchange administrator to be configured must have administrative rights for mailboxes, etc. Multiple, different accounts can be entered.

  1. Create the credential in ScriptRunner under “New+” or in the main “Credentials” menu with “Create”.
  2. Then enter the name and password.
  3. Now set the tag “Exchange” and other tags if necessary.
Screenshot: Credential Properties in the ScriptRunner Admin App

Create an administrative Exchange account

Set up the Exchange Server as the target system:

  1. Create the Exchange Server in ScriptRunner under “New+” or in the main menu “Targets” with “Create”.
  2. Now enter the FQDN of the server and select the Credential that has been set up. Also assign the “Exchange” tag.
  3. Then, on the PS Remoting Settings tab, specify the Exchange PowerShell target type. This selection causes the PowerShell connection not to be established via Remote Management Service by default, but to the Exchange Shell via IIS.
  4. Finally, enable the Implicit PowerShell Remoting option. This selection makes the Exchange Shell directly available on the ScriptRunner host. This means that no changes need to be made to the Powershell settings on the Exchange Server.

IMPORTANT: For error messages, check the authentication method and set it accordingly with the second option “Use a non-default authentication method”. Depending on the domain constellation Kerberos, Negotiate or another may be necessary !

Screenshot: Target system configuration in the ScriptRunner Admin App

Set up Exchange server as target system

Simply activate the implicit remoting. Additional session options such as -SkipNCheck, -SkipRevocationCheck, -SkipCACheck must be entered in the bottom option field. A switch option must be assigned the value 1. An entry of options would then look like this:

SkipNCheck=1
SkipRevocationCheck=1
SkipCACheck=1

 

Step 3: Check connection to Exchange server manually

To ensure that a connection to Exchange server can be established, a check is performed.

This is how the connection to the Exchange Server is checked:

  1. Open PowerShell on ScriptRunner Host as an administrator.
  2. Execute the following command sequence:
>$pw = ConvertTo-SecureString -String ‘password' -AsPlainText -Force
>$cred = New-Object -TypeName pscredential -ArgumentList ‘account',$pw
>$session=new-pssession -ConfigurationName Microsoft.Exchange -ConnectionUri  http://exchangeserver.fqdn/powershell/ -Credential $cred
# additional session options may be necessary depending on the constellation in your environment
# Eg: -Authentication method -SkipNCheck, -SkipRevocationCheck, -SkipCACheck
>Import-PSSession -Session $session
 
>get-command –module ‚temp_module_name‘
-> in the given example
>get-command –module tmpkc1p04s0.z4c
Screenshot: PowerShell

Example command in PowerShell

Configure sample command in the PowerShell actions with the scripts from the ActionPack. The connection to the Exchange server works, the setup is complete and actions can now be configured and executed.

Set Up Actions:

  1. In ScriptRunner, select the Scripts main menu. Here you can find the corresponding Exchange Scripts.
  2. Now select a desired script and create a new action. Since the tags for the scripts are automatically created from the directory names, they do not have to be configured separately. In this example, the tag “Exchange” and “Mailboxes” are preset.
  3. The target selection also suggests the Exchange Server for the action, if it was tagged with “Exchange”.
  4. Optionally, you can now make various settings and presets for the action. The action is then configured, can be used and also delegated.
Screenshot: Configuration of an action in the ScriptRunner Admin App

Configuration of an action in the ScriptRunner Admin App

Screenshot: Selection of the target system in the action configuration

Selecting Exchange Server as target system in the action configuration

Are you interested in the topic Exchange Administration with the ScriptRunner ActionPack? More information can be found in our webinar recording Effectively Design and Securely Delegate Exchange Administration with PowerShell and ScriptRunner ActionPack“!

 

Related posts

2 min read

VMUG Webcast: Mastering VMware Management with PowerCLI

3 min read

Automate your spring cleaning with PowerShell

5 min read

Mastering PowerShell with Get-Help

About the author: