【转载】Powershell连接世纪互联Office365

 

1 $User = "admin@contoso.com"
2 $PWord = ConvertTo-SecureString –String "password" –AsPlainText -Force
3 $Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord
4 Import-Module MSOnline
5 Connect-MsolService -Credential $Credential
6 $sessionOption = New-PSSessionOption -SkipRevocationCheck
7 $ExchangeShell = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://partner.outlook.cn/PowerShell-LiveID?PSVersion=2.0 -Credential $Credential -Authentication Basic -AllowRedirection -SessionOption $sessionOption
8 $importresults = Import-PSSession $ExchangeShell

http://www.smallrascal.cn/smallrascal/article.asp?id=2080

posted @ 2014-10-15 10:24  Anderson.Ling  阅读(757)  评论(0编辑  收藏  举报