Connect to Exchange Online with Powershell

In my previous post I talked about using Powershell to connect to Office 365 to manage the service. Using that method you will be able to manage user accounts and other settings that only apply to the Office 365 service itself. If you would like to connect to Exchange Online with Powershell to manage users’ mailboxes then Microsoft also provides cmdlets that allow you to perform these tasks.


Install Microsoft .NET Framework 4.5.x

Install Windows Management Framework 3.0 or 4.0

Launch Powershell

You will want to right click Powershell and use Run as Administrator.

Office 365 Credentials

Now that you have the Powershell window ready to go, issue the following command in the Powershell window. Once you do, it will launch a window requesting your username and password for Office 365.

$cred = Get-Credential

Getting Office 365 Credential

Connecting to Exchange Online

With the credential stored you can now use it to connect to the Exchange Online service.

$exchSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri “https://outlook.office365.com/powershell-liveid/” -Credential $credential -Authentication “Basic” -AllowRedirection

If authentication was successful, you are now connected to your Exchange Online organization and can manage your service from there.

Disconnecting from Exchange Online

Once you’ve finished the Exchange Online management tasks in Powershell you will then need to free up your session by removing it.

Remove-PSSession $exchSession

Connecting to Exchange Online with Powershell

Stop Exchange 2010 From Changing Resource Calendar Subject Lines

If you’re using resource mailboxes in Exchange 2010 and have it automatically process meeting invites, then you may notice that the subject lines are getting stripped and replaced with the organizer’s name. Depending on how you are using the resource mailbox, this may be an undesired action. If you wish to leave the original subject in the calendar entry, run the following command in the Exchange Management Shell:

Set-CalendarProcessing -Identity ResourceMailbox -AddOrganizerToSubject $false -DeleteSubject $false

Exchange 2010 Move Requests With BadItemLimit Larger Than 49

If you’re performing a local move request in Exchange 2010 using the Exchange Console, it will only allow you to set a BadItemLimit up to 49 items. To allow a higher amount you need to do use the Exchange Shell. Use the following syntax, replacing SomeUser, ExchDB, and 75 with the appropriate values:

New-MoveRequest -Identity ‘SomeUser’ -TargetDatabase ExchDB -BadItemLimit 75 -AcceptLargeDataLoss

© 2015 Dustin Riley

Theme by Anders NorenUp ↑