EEEKB article--Play the five Exchange Online services in Office 365 How to manage with the PSL connection to Exchange online

Source: Internet
Author: User

A brief introduction to the global management of Office 365 has been done earlier, and the following will be introduced into the topic--exchangeonline of this series. The Office 365 Web control page provided by Microsoft does manage the ongoing maintenance of exchange online, but requires advanced management, which requires PowerShell. As with Exchange Server, many of the operations of Exchange online need to be done through PowerShell. Therefore, you first describe how to connect PowerShell to Exchange Online in Office 365.

I. System requirements for PowerShell connectivity to Exchange online

Windows that connect to Exchange online can be:

    • Windows 8/8.1

    • Windows Server 2012/2012 R2

    • Windows 7 SP1

    • Windows Server R2 SP1

If you are Windows 8/8.1 or Windows Server 2012/2012 R2 You can connect to exchange Online directly through PowerShell that comes with your system.

If you are window 7 SP1 or Windows Server R2 SP1, you first need to install the Microsoft. NET Framework 4.5/4.5.1, and then install the Windowsmanagement framework 3.0/4 .0 to connect to Exchange Online through PowerShell.

Ii. how PowerShell connects to Exchange online

Using local powershell to connect to Exchange online in Office 365 requires three steps, first providing an administrator or user account for Exchange online logins, followed by configuring connection settings, and finally requiring the exchange The online command is imported into the current session of the local PowerShell. After you complete the steps above, you can use PowerShell to manage Exchange online.

1 , defining exchangeonline Login credential variables

With the get-credential command, the user credentials are obtained through the User Account Password Input dialog box and assigned a variable.

$UserCredential =get-credential

650) this.width=650; "src=" "title=" 01.png "alt=" Wkiol1wqcfvgtjo7aac-boepbv4713.jpg "/>

In the pop-up user account Login dialog box, enter the user account and password for Office 365. Click "OK" to complete the assignment of the variable $UserCredential .

650) this.width=650; "src=" "title=" 02.png "alt=" Wkiom1wqcepdqkzkaad0pnuejve426.jpg "/>

2 , configure connection Settings

Create a new PowerShell session configuration with New-pssession and assign the configuration information to a variable.

$Session = New-pssession-configurationname -credential $UserCredential-authentication basic-allowredirection

650) this.width=650; "src=" "title=" 03.png "alt=" Wkiol1wqcguweo_8aagtjcg0tlc975.jpg "/>

The specific meaning is: Create a session configuration, the configuration is named "", the session connection URL is "" This is the connection address for the century connected Office 365, and if it is a global version of Office 365, the address is "Https://". The identity credential provided is "$UserCredential", that is, the identity credential variable that was previously defined. Takes Basic authentication and allows the connection to be redirected to the specified URL.

3 , import session configuration

Use Import-pssession to import the session configuration created in the second step.

Import-pssession $Session

650) this.width=650; "src=" "title=" 04.png "alt=" Wkiom1wqcfjzeemfaako5ifijsg522.jpg "/>

After successful execution, you may receive a warning that can be ignored. You have now implemented the local PowerShell connection to Exchange Online in Office 365. The actions in the current PowerShell session will directly affect Exchange Online.

4 , verify that the connection is successful

You can verify that you are connected to the specified Office 365 subscription by using the Simple Exchange Online Administration command. For example, look at accepted domains in your subscription organization or view current user mailboxes.

Use the get-accepteddomain command to see the domain name that you specified when you subscribed to Office 365 and the custom fields that you added later.

650) this.width=650; "src=" "title=" 06.png "alt=" Wkiol1wqcilyt3ihaad-aansshy407.jpg "/>

Use the get-mailbox command to list the mailbox lists for all users in the current subscription, and the remaining capacity of the server and mailbox on which they reside.

650) this.width=650; "src=" "title=" 05.png "alt=" Wkiom1wqcgrcsntlaae-n6scg-4635.jpg "/>

5 , disconnecting from the Exchangeonline

You can use the remove-pssession command to disconnect a specified configuration session.

Remove-pssession $Session

650) this.width=650; "src=" "title=" 07.png "alt=" Wkiol1wqcjlxwbaiaabmfzviaqg490.jpg "/>

It is strongly recommended that you perform a disconnect before closing the PowerShell window. Because, if you do not disconnect, Exchange online continues to retain this session, even if the PowerShell window is closed, and is automatically disconnected until it expires. Because the total number of sessions is limited, in order to prevent a Dos attack, only three simultaneous sessions are available. Therefore, if a session that has previously closed the PowerShell window is not broken in time, it is likely to run out of three sessions, which will prevent you from connecting to Exchange Online. You can only wait for the session timeout expiration to automatically disconnect before you connect.

6 , using scripting to connect Exchangeonline

You can save a three-step PowerShell command to a PowerShell script file. When you need to connect, you can simply execute the script to create a connection session.

The specific action is to save the following as text to a *.PS1 file.

$UserCredential = get-credential

$Session = New-pssession-configurationname -credential $UserCredential-authentication basic-allowredirection

Import-pssession $Session

When you need to connect, simply run the script in PowerShell and enter the appropriate Office 365 user account and password to establish a connection session.

Iii. Exchangeonline PowerShell Management restrictions

Even if you are the initial administrator account for an Office 365 subscription, it is not possible to use all of the PowerShell commands for Exchange after you connect to Exchange online through PowerShell. There are two types of cases, one due to Office 365 limitations, some administrative commands that Microsoft does not provide to users, and for security considerations and Office 365 optimizations, which by default do not give users permission to use these commands, even if they are the initial administrator or organization Administrator of the subscription. In the second case, you can use the permissions management item in the Exchange Online Admin Center to assign the required role to the administrator or user through the role group, and once the default role is available, the user is able to work with the PowerShell commands for that role.

Additionally, you can disable and enable the user's remote PowerShell connection Exchange online feature by using the following command.

Set-user [email protected] remind you not to spam ads!-remotepowershellenabled $false

Set-user [email protected] remind you not to spam ads!-remotepowershellenabled $true

This article is from the "Fat Brother Technology Hall" blog, please be sure to keep this source

EEEKB article--Play the five Exchange Online services in Office 365 How to manage with the PSL connection to Exchange online

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.