How to Connect to Exchange Online (Office 365) from Windows PowerShell
I’m presenting simple steps to follow to connect to your cloud based Exchange Online organization as the part of Office 365 from Windows Powershell
1. Install Windows PowerShell and Windows Remote Management (WinRM) on your computer (Windows 7 is already equiped with the features)
2. Open Windows Powershell (Run as Administrator) and run the following cmdlets
$LiveCred = Get-Credential You will be asked to provide the account information as below: Give user name and password
Run the cmdlet $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
You will get the following information at your powershell window:
WARNING: Your connection has been redirected to the following URI: “https://pod51022psh.outlook.com/PowerShell-LiveID?PSVersion=2.0 ” WARNING: Your connection has been redirected to the following URI: “https://sixprd0410psh.outlook.com/PowerShell-LiveID?PSVersion=2.0 “
Run the cmdlet Import-PSSession $Session
A progress indicator appears that shows the importing of commands used in the cloud-based service into the client-side session of your local computer. When this process is complete, you can run these commands.
Now you are able to run all the allowed cmdlets in the session like get-mailbox, get-distributiongroup, get-messagetrackinglog etc. etc.
To disconnect the session run the cmdlet: Remove-PSSession $Session