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.

 
 
« November 2024»
SunMonTueWedThuFriSat
     12
3456789
10111213141516
17181920212223
24252627282930
 
Links
 
Quote
« Debating Windows vs. Linux vs. Mac is pointless: they all have their merits and flaws, and it ultimately comes to down to personal preference. »
Me