If you’re going to be working with Office 365 via PowerShell, it’s a good idea to set up your computer with the appropriate PowerShell cmdlets and versions.
It’s also a good idea to create shortcuts to the various Office 365 services, so you can quickly log on to them without having to copy and paste commands one by one.
Here are some instructions on TechNet that detail the prerequisites for a connection to Exchange Online, though you might find you’ve got these installed already:
Easily connect to Exchange Online via PowerShell
Open PowerShell as an administrator
Go to Start, search for PowerShell, right click Windows Powershell and Run as Administrator
Create a PowerShell profile with a function
New-item –type file –force $profile
Now copy the following PowerShell function into the notepad document and save it:
(Be sure to replace [email protected]nmicrosoft.com with a global admin).
$credentials = Get-Credential -Credential [email protected]
Write-Output “Loading the Exchange Online cmdlets”
$Session = New-PSSession -ConnectionUri https://outlook.office365.com/powershell-liveid/ `
-ConfigurationName Microsoft.Exchange -Credential $credentials `
-Authentication Basic -AllowRedirection
Use the new function to connect quickly to Exchange Online
Close Powershell and run it again.
From now on you can just type Connect-ExchOnline to connect.
Run the new Function To Connect To Exchange Online
Enter your password and away you go.