Before You Start

Here is a method for connecting to Exchange Online (Office 365) with PowerShell​

  • To enable Windows PowerShell to run signed scripts, run the following command in an elevated Windows PowerShell window (a Windows PowerShell window you open by selecting Run as administrator):
    Set-ExecutionPolicy RemoteSigned
    

    You need to configure this setting only once on your computer, not every time you connect.

  • For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard shortcuts in the Exchange admin center.
tipTip: 
Having problems? Ask for help in the Exchange forums. Visit the forums at: Exchange ServerExchange Online, or Exchange Online Protection.

Connect to Exchange Online

  1. On your local computer, open Windows PowerShell and run the following command.
    $UserCredential = Get-Credential
    

    In the Windows PowerShell Credential Request dialog box, type your Office 365 user name and password, and then click OK.

  2. Run the following command.
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
    

    Note   If you are an Office 365 operated by 21Vianet customer in China, use the following value for the ConnectionUri parameter: https://partner.outlook.cn/PowerShell.

  3. Run the following command.
    Import-PSSession $Session
    
noteNote: 
Be sure to disconnect the remote PowerShell session when you’re finished. If you close the Windows PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you’ll need to wait for the sessions to expire. To disconnect the remote PowerShell session, run the following command.
Remove-PSSession $Session​

 

Used for Office 365 management with great success!

From Microsoft: https://technet.microsoft.com/en-us/library/jj984289(v=exchg.160).aspx​​​

PowerShell Management of Exchange Online
Tagged on:
%d bloggers like this: