Friday , June 21 2024
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

The pain of TLS 1.2 with PowerShell module for Azure Active Directory (MSOnline)

Building labs in a hurry sometimes can bite you with recent changes in Office 365 …

Leave a Reply

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