Friday , April 16 2021
Home - Don't Forget! - How to invoke/test Office 365 (Exchange Online) cmdlets via Remote Powershell

How to invoke/test Office 365 (Exchange Online) cmdlets via Remote Powershell

I’ve been working on some PowerShell scripts for use with Office 365 and needed to invoke/test Office 365 (Exchange Online) cmdlets via RemotePowerShell.  This post relates to connections to Office 365 and Exchange online. My previous post How to invoke test exchange 2010 cmdlets via remote PowerShell 2.0 window, however the following allows for the credentials to be different from the current logged on user.

Office 365 allows powershell access with a generic connection location and with the added cmdlet switch of ‘-AllowRedirection’ redirects your powershell connection to you correct CAS location.

First capture the credentials used to connect to Office 365 into a memory variable with the command:


(Enter you Office 365 admin logon details)

This makes the connection to Office 365 RemotePowerShell endpoint.

This will complete the connection and download the cmdlets from Office 365 to your Powershell Window.

To check if the connection is complete use:

You can use the -prefix to make serval Office 365 connections to different tenants at the same time or connect to Exchange On-premises with Office 365.

An example to allow such commands of New-O365Mailbox or Get-O365OrganizationConfig

Check Also

How to use DNS Pin Point instead Split Horizon – the easy way!

Background on the DNS issue faced There are times when DNS split horizon is required …

Leave a Reply

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