This one was a new experience for me. After brewing a good cup of Caturra variety coffee at home, a friend contacted me wanting to connect to Exchange online using PowerShell. This was due to some strange email activity with one of her users. Connecting to Exchange Online using PowerShell allows administrators to manage Exchange Online settings, mailboxes, and other features remotely.

First you need to check if the Exchange Online module is installed:

Get-Module -ListAvailable -Name ExchangeOnlineManagement

If the module is not installed, open a Windows Powershell and run as Administrator:

Install-Module -Name ExchangeOnlineManagement -Force

Follow the prompts. Yes, you can install from untrusted repositories. Press Y to confirm. If you already have the module installed and want to update it:

Update-Module ExchangeOnlineManagement

Now, connect to Exchange online:

Connect-ExchangeOnline

Enter your credentials in the pop up window. Usually using MFA (Multi-factor Authentication).

After you connect you can run the desired command against any inbox. For example we wanted to check all rules on a shared inbox:

get-inboxrule -mailbox sharedbox@hola.com  | fl 

After you’re done, you can disconnect:

Disconnect-ExchangeOnline -Confirm:$False

Remember to contact me if you have any questions or like to collaborate. Thanks!

Leave a comment

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