Remote connection to Exchangeonline using PowerShell

Source: Internet
Author: User

You can use the following Windows version:

Windows 10

Windows 8 or Windows 8.1

Windows Server or Windows Server2012 R2

Windows 7 ServicePack 1 (SP1) *

Windows Server 2008R2 sp1*

 * Span lang= "ZH-CN" style= "Font-size:10.5pt;font-family:simsun;" xml:lang= "ZH-CN" > need to install Microsoft. NET Framework 4.5 4.5.1 Windows Management Framework 3.0 Windows Management Framework 4.0


1, in order to make Windowspowershell to be able to run signed scripts, use the Windows PowerShell (Run as Administrator opens the Windows PowerShell ), run the following command:

set-executionpolicyremotesigned

and enter the command get-ExecutionPolicy to confirm that the value is remotesigned.

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/79/36/wKiom1aLhsXjt2t8AAAixafvVkI670.png "title=" 02.png "alt=" Wkiom1alhsxjt2t8aaaixafvvki670.png "/>



2. Enter and run the following command:

$UserCredential = get-credential

and enter the user name and password with administrator privileges in O365.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/36/wKiom1aLh5jBC7jDAACwkmS204c762.png "title=" 03.png "alt=" Wkiom1alh5jbc7jdaacwkms204c762.png "/>



3. Enter and run the following command:

International Version O365

$Session = New-pssession-configurationname Microsoft.exchange-connectionuri Https://outlook.office365.com/powershell-liveid/ -credential $UserCredential-authentication basic-allowredirection


Domestic version O365

$Session = New-pssession-configurationname Microsoft.exchange-connectionuri Https://partner.outlook.cn/PowerShell -credential $UserCredential-authenticationbasic-allowredirection


650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/35/wKioL1aLiLmCjyccAAAydJa-Vnc599.png "title=" 04.png "alt=" Wkiol1alilmcjyccaaaydja-vnc599.png "/>


4. Enter and run the following command:

Import-pssession$session

After running, an implicit remoting module is created.

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/79/36/wKiom1aLiTaR3WXeAAA_oHYslyI718.png "title=" 05.png "alt=" Wkiom1alitar3wxeaaa_ohyslyi718.png "/>

After the process is finished,

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/79/35/wKioL1aLiaeDruW8AABF5BHUsqU887.png "title=" 06.png "alt=" Wkiol1aliaedruw8aabf5bhusqu887.png "/>


5. Connect to Exchangeonline

Connect-msolservice

Re-enter the account and password with administrator privileges in O365.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/79/35/wKioL1aLimTBkos9AACWgNcPE4k749.png "title=" 07.png "alt=" Wkiol1alimtbkos9aacwgncpe4k749.png "/>


6, congratulations, you can use the PowerShell command to query exchangeonline!


PS: make sure to disconnect from the remote after completion PowerShell the connection to the session. If you close the Windows PowerShell window in a continuous session connection, you may run out of all of the remote PowerShell sessions that are available, and then you will need to wait for those sessions to expire. To disconnect a remote PowerShell session, run the following command:

Remove-pssession$session



This article is from the "Stanleytam" blog, make sure to keep this source http://321674.blog.51cto.com/311674/1731809

Remote connection to Exchangeonline using PowerShell

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: info-contact@alibabacloud.com 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.