Powershell连接Office 365各组件的方法

参考: 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

断开: Get-PSSession | Remove-PSSession

 

2. Connect to SharePoint

Connect-SPOService -Url https://company-admin.sharepoint.cn -Credential $creds

验证: Get-SPOSite

断开: 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

断开: Remove-PSSession $exchangeSession

 

4. Connect to Lync

$LyncSession = New-CsOnlineSession -Credential $creds

Import-PSSession $LyncSession

断开: Get-PSSession | Remove-PSSession

你可能感兴趣的:(powershell)