Install Exchange Online PowerShell Module
- Open Internet Explorer or Edge. (If you are using the Chromium version of Edge you will need to enable Edge OneClick [chrome://flags/#edge-click-once]). Other browsers are not supported.
- Go to https://outlook.office365.com/ecp or your local exchange server, whatever it is named…
- Go to Hybrid in the sidebar and click on configure for “Exchange Online PowerShell Module”.
- Click on “Install” to install the module
Connect to Exchange Online PowerShell with MFA
Open a PowerShell window or the “Microsoft Exchange Online Powershell Module”.
Connect-EXOPSSession -UserPrincipalName your.name@companyname.com -DelegatedOrganization companyname.onmicrosoft.com
Test if it’s working
To see if things are working you can run a test command:
Get-Mailbox -ResultSize 5
This will list the first 5 mailboxes available.
Connect to Exchange Online PowerShell without MFA.
This is the old way of connecting. Not recommended but supplied nonetheless.
Allow running scripts:
Set-ExecutionPolicy RemoteSigned
Establish a new Exchange online session:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import the session
Import-PSSession $Session -DisableNameChecking
When you are finished working you can close the session with:
Remove-PSSession $Session