Reference: http://www.exchangecn.com/office365/20150108_540.html
$PW = convertto-securestring ' password '-asplaintext-force
$creds = New-object-typename system.management.automation.pscredential-argumentlist ' [email protected] ', $PW
1. Connect to Office 365
Connect-msolservice-credential $creds
Verify:get-msoldomain
Disconnect: get-pssession | Remove-pssession
2. Connect to SharePoint
Connect-sposervice-url https://company-admin.sharepoint.cn-Credential $creds
Verification: Get-sposite
Disconnect: Disconnect-sposervice
3. Connect to Exchange Online
$ExchangeSession = New-pssession-configurationname Microsoft.exchange-connectionuri https://partner.outlook.cn/ Powershell-credential $creds-authentication basic-allowredirection
Import-pssession $ExchangeSession
Disconnect: Remove-pssession $exchangeSession
4. Connect to Lync
$LyncSession = new-csonlinesession-credential $creds
Import-pssession $LyncSession
Disconnect: get-pssession | Remove-pssession
How PowerShell connects the components of Office 365