Backtrack:  
 
by lunarg on July 9th 2018, at 14:30

You can manage Exchange Online through Powershell in a similar fashion as you would an on-premise Exchange. There are some differences between available cmdlets and what they do between on-premise Exchange and Exchange Online, but the majority are the same.

Using multi-factor authentication
The method mentioned below is deprecated and only works for non-MFA usage. If you are using multi-factor authentication, you will have to use the Exchange Online Remote PowerShell Module to connect to Exchange Online. Instructions can be found in this article.

Using PS remoting, the cmdlets for Exchange Online are imported through the internet, so first, you need to change the Powershell execution policy to allow remotely signed modules to be loaded. In an elevated Powershell, run this:

Set-ExecutionPolicy RemoteSigned

This prevents errors about not being digitally signed during import. If the above command is not accepted, you probably don't have admin privileges. Either use an elevated Powershell or ask your network administrator to enable it for you.

To make the actual connection, run these in a regular Powershell:

$cred = Get-Credential
$office365 = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $cred -Authentication Basic –AllowRedirection
Import-PSSession $office365

This will start to import several modules, adding the required cmdlets to your session. When completed without errors, the Exchange management cmdlets will be available. These are roughly the same as on a on-premise Exchange server.

 
 
« April 2024»
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
282930    
 
Links
 
Quote
« Most people tend to avoid true conflict. Ironically this breeds more conflict. »