Remote Powershell connection to hosted Exchange (Office 365)

I don’t know about you, but although I find the Exchange Administration Console OK for basic tasks, you can’t beat Powershell for Exchange (or AD, Hyper-V, SQL etc) Administration.

Following a Cloud migration from on-premise Exchange recently, I had a few issues connecting to the remote Microsoft Hosted Exchange Server(s) through Powershell (from my Windows 10 client).

Eventually got it sussed through this script:

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.protection.outlook.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

When finished, don’t forget to close your PSSession with Remove-PSSession (get-pssession for the id).

Remote Powershell to hosted Exchange from Windows 10

Remote Powershell to hosted Exchange from Windows 10

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.