PowerShell plays a central role in managing Exchange, both Microsoft 365 and on premises. Instead of running commands and scripts on the server console, you can install the Exchange module on a workstation. On premises, this requires a little more effort.

Microsoft currently provides version 2 of the PowerShell module for Exchange Online. The installation there works as follows.

First, you must check the standard authentication for Windows Remote Management (WinRM) and, if necessary, configure it from a command prompt with administrative rights. To view the current settings, enter this command:

Displaying current settings for WinRM authentication

By default, the value for Basic should already be true. If this is not the case, you can change it using this:

If this setting is not configured as described, the following error message will appear when you try to connect to Exchange Online:

"The WinRM client cannot process the request. Basic authentication is currently disabled in the client configuration. Change the client configuration and try the request again."

Installing the module for Exchange Online ^

To be able to execute scripts, if not already done, you have to loosen the execution policy:

Next, execute the following command from a PowerShell console with administrative privileges.

After this step, close the PowerShell console and then open it again with elevated privileges. Next, I will install the module ExchangeOnlineManagement:

Installing the ExchangeOnlineManagement PowerShell module

Now you use…

…to connect to Office 365 in order to send commands.

Connecting to Exchange Online by using the Connect ExchangeOnline cmdlet

Connecting to Exchange Online by using the Connect ExchangeOnline cmdlet

After you log on, the command will print a small table that shows which cmdlets have changed with the new module.

Installing Exchange Management Shell ^

On premises, the whole task is a bit more complex because PowerShell for Exchange is part of the management tools. These are on the Exchange installation media.

The first step is to enable some optional features:

Enabling optional features required by the Exchange management tools

Enabling optional features required by the Exchange management tools

In addition, you have to ensure that the correct version of the .NET Framework is installed. After that, you need to add the Microsoft Visual C++ 2012 Redistributable before you can start the actual installation.

The Microsoft Visual C++ 2012 Redistributable is another requirement for the management tools

Now you start the installation of the Exchange management tools with this command:

After executing the setup, you use either the local Exchange PowerShell or the snap-in to administer Exchange.

Setup adds an icon for the Exchange Management Shell to the Start menu

Setup adds an icon for the Exchange Management Shell to the Start menu

Update ^

From time to time, you must update both the module for Exchange Online and the management shell for a local Exchange. For Exchange Online, enter the following commands for this purpose:

For Exchange on premises, current versions come via cumulative updates every quarter.

Join the 4sysops PowerShell group!

Your question was not answered? Ask in the forum!

0
Share
1 Comment
  1. Tayfun Deger 3 weeks ago

    fast and beautiful method.

    0

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account