Linking to Office 365 with PowerShell

Source: Internet
Author: User

Today's main talk about using PowerShell to manage Office 365 can be divided into office365 user management, Exchange online management, etc.

1. Use PowerShell to link to the Office 365 User management interface

Need to install Login Assistant and Azure AD module first

Run under Windows PowerShell:

Get-executionpolicy
Set-executionpolicy remotesigned//Change execution policy, execute once is enough
$credential = get-credential//Create credentials
$credential//Authentication credentials
* Connect to office365 above (first import module, install login Assistant, Azure ad module)
* Note that if Azure Adconnect is installed, the prerequisites are automatically installed successfully
Import-module MsOnline//import office365 module
Get-module//Verify whether to import the module, if return manifest MSOnline {add-msoladministrativeunitme ... That is, the import module succeeds
Connect-msolservice-credential $credential//connected to office365
Get-msoldomain

or using a comprehensive code

" [email protected] "  "password" –asplaintext-= New-object-typename System.Management.Automation.PSCredential-argumentlist $User, $PwordImport-Module msonlineconnect -msolservice-credential $Credential

2. Use PowerShell to link to the Office 365 Exchange Online Management interface

Run under Windows PowerShell:

Set-executionpolicy remotesigned
$UserCredential = get-credential//(Get login credentials for office365)
$Session = New-pssession-configurationname Microsoft.exchange-connectionuri Https://partner.outlook.cn/PowerShell- Credential $UserCredential-authentication basic–allowredirection//International version URL for; Https://outlook.office365.com/powershell-liveid/
Import-pssession $Session

or using a comprehensive code

Linking to Office 365 with 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.