Try Now

Exchange and Office 365 with PowerShell: Administration made easy

Table of Contents

Post Featured Image

It is a daily field of tension in which an admin moves: On the one hand he wants to develop concepts and strategies around Exchange Online and Office 365.

On the other hand, ad-hoc tasks such as setting up new mailboxes or out-of-office notifications crack down on him. Unfortunately, the fun – and the core – of the work often recedes into the background. But how can the dilemma be solved? The magic words are PowerShell, Automation and Delegation.But PowerShell makes the start. First, a connection to the Exchange or Office 365 client is established. After installing the PowerShell modules, you’ll be able to start with the first PowerShell commands and use one-liners to gradually create appropriate scripts to perform recurring tasks over and over again.

 

 

 

Example: Out-of-Office-Management with PowerShell

Let’s take a closer look at this using the example of out-of-office management: 

  • You open the classic ISE.
  • You open the RunSelection function and enter your user name and password. Now you are logged in to the Office 365 client and the commandlets are loaded.
  • If you now want to change certain out-of-office settings, you also need permissions to do so. However, queries to department heads and works councils are a thing of the past.

Now you can see how the mailbox of an individual, a group or the entire workforce is currently set. To do this, use the commandlet Get-MailboxAutoReplayConfiguration.
If you put a set in front of it, you can adjust the text of the out of office note as required. Time-controlled out-of-office notes, i.e. with start and end dates, can also be set in this way. Absence notes can also be deactivated.

 

So now you have a tool that you can use to perform the tasks – but you still must do it yourself or hire a PowerShell expert. The effort can be reduced even further, can’t it?

Automation and Delegation with ScriptRunner

You would like to pass on what you have now implemented natively with PowerShell scripts to colleagues for execution – even those who do not have PowerShell expertise or full admin rights? You also want scripts to be developed and executed in a team, even if more than three parallel sessions are required?

Then the first step is to create a standardized procedure. With the help of the ISE plugin in ScriptRunner, users can see all available scripts – whether developed by themselves or as GitHub standards – their versioning and possible access problems at a central point. Here you can see which scripts are released for editing, make changes, check them in directly and leave comments for your colleagues.

With the ScriptRunner Admin App you can now configure certain actions. For example, certain users can edit out-of-office settings for the EMEA organizational unit. These actions are linked to other objects so that the management can be carried out: with the so-called queries. For example, you determine which accounts can be selected for the ScriptRunner user in order to make the desired settings for these mailboxes in the next step.

You have three options:

  • Switching on out-of-office
  • Switch off out-of-office
  • Terminate out-of-office scheduling

Scheduling a notification is certainly the most common scenario.

To do this, first select the mailboxes for which you can configure out-of-office and then determine the text or select predefined content. The ability to centrally define text modules for different use cases, such as vacation, illness, or training, ensures a uniform company-wide appearance. The start and end dates of absences can be inserted dynamically as variables in the absence notification. A convenient calendar control is available here. As an admin, this is already a real work facilitation – but nobody else can still take over the task.

With the Delegate App of ScriptRunner administrators can now safely delegate the mentioned tasks to Helpdesk employees or colleagues from the departments. They do not need PowerShell knowledge or privileged permissions, because the ScriptRunner Server does the actual processing.  With the help of the queries, it is determined whether an employee may manage mailboxes of the entire organization or whether he/she is only responsible for certain departments.

The delegated actions are available to the users via a comfortable web interface. Each action is represented by a tile in the Delegate App. In order to keep the overview even with a larger number of assigned actions, similar tasks can be color-coded and grouped using freely definable tags. In addition, the user can mark frequently used actions as favorites. This makes them available immediately after starting the Delegate App.

 

The use case “absence management” at a glance:

  • Action: Activate out-of-office
  • Query: Select Mailbox
  • Targets: Exchange or Exchange Online
  • Scripts: Set-Out_Of_Office.ps1
  • Credentials: Service account with the required authorizations
  • Delegation: Helpdesk user, End user

Keeping track thanks to monitoring

With ScriptRunner administrators are also able to execute scripts on multiple servers on a scheduled basis. The ScriptRunner Dashboard provides a central overview of all PowerShell activities. Among other things, it makes visible which action would be executed by a user at which time. This allows a better traceability of tasks as well as the recognition of possibly different execution results.

Conclusion

The combination of Exchange On-Premise and Exchange Online with the corresponding PowerShell modules and the functions of ScriptRunner make the automation and delegation of Exchange very convenient and secure. This relieves administrators of routine tasks, and the Helpdesk team can process many requests from end users faster and in a standardized way.

Besides using ScriptRunner with Exchange and Office 365, all PowerShell supporting systems can be managed with ScriptRunner. Examples: Sharepoint, Azure, Hyper-V, VMware, AWS, etc.

Would you like to learn more about the topic? Then take a look at our free webinar recording “Automating and Delegating Exchange/O365 Administration with PowerShell”. 

About the author: