PowerShell Automation

Execute Microsoft Exchange Powershell commands from IT process automation solution

PowerShell-AutomationIf you’re using Microsoft Exchange 2010, you probably already know how convenient the PowerShell technology is in terms of creating an interface that can facilitate the automation of a number of manual tasks. Now, you can further harness the power of IT process automation by using Ayehu eyeShare to execute PowerShell commands in less than 5 minutes. Here’s how.

To watch an interactive video tutorial demonstrating how to execute Powershell from Ayehu eyeShare, please click here.

Getting Started with PowerShell Command 

To begin, you’ll first need to install Exchange Management Tools on your Ayehu eyeShare server. To do so, simply execute the exchange setup and select “Custom Installation”. Once the installation is complete, the first step involves specifically defining the PowerShell command in eyeShare. To do so, go to:

  • Repository
  • Commands
  • Create New Command

For a 64 bit server, enter the following command: Powershell. Use Powershell.exe for a 32-bit server.

Defining Commands in the eyeShare Workflow

To begin defining commands, simply go to:

  • Studio
  • Workflows
  • Create New Workflow

Now, drag and drop the “Executor” action from the execution section and select the PowerShell command that you just created. It’s important to note that the Exchange Powershell command must begin with the following arguments and be followed by the specific command:

-inputformat none –command “. ‘c:Program FilesMicrosoftExchange ServerV14binRemoteExchange.ps1’; Connect-ExchangeServerServerName.DomainName.com –ExecutionPolicy Bypass; <command>

You can also find these arguments on the Ayehu website. Be sure to replace the server name parameter with your Exchange server name and domain name. Edit the default argument to include the appropriate server and domain name in the “Argument” section of the execution file. Then, to execute the operation, add the relevant command.

As an example, let’s execute the “Get Mailbox Statistics” command for username Nick. Start by replacing the “Username” parameter with the relevant user (of course, this can be a variable as well). Once you’ve modified the argument to include the appropriate username, press the “run” button to execute the workflow. You can check the active logs at the bottom of the screen to view the execution results. If everything looks good, save and close the workflow.

An excellent sample of a completed workflow is one that monitors the mailbox quota of a list of users. In the event the quota usage exceeds 80% percent, it increases its size and sends out a notification. The workflow reads a list of users from the selected OU and uses the “Get Mailbox Statistics” PowerShell command to retrieve the mailbox size of each user. Then, it uses the “Get Mailbox” PowerShell command to retrieve the user mailbox quota.

The workflow then calculates the current usage at the user mailbox, and when it’s higher than 80%, it increases its quota using the “Set Mailbox” PowerShell command. Then, it rechecks the quota size and sends a notification email the system administrator.

How It Works

In the provided sample workflow, eyeShare begins by retrieving a list of users from the selected OU. Then the program:

  • Extracts each individual username
  • Retrieves the user’s mailbox size
  • Retrieves the user’s mailbox quota
  • Calculates the mailbox usage
  • Automatically increases that usage quota
  • Rechecks the quota size
  • Sends a notification email to the System Administrator

IT Process Automation Survival Guide