Powershell连接世纪互联Office365

 

1 $User = "[email protected]"

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

你可能感兴趣的:(powershell)