珀耳塞福建 发表于 2017-7-1 09:53:04

使用Powershell链接到Office 365

  今天主要讲使用Powershell管理Office 365 可以分为office365用户管理,Exchange Online的管理等
  1. 使用Powershell 链接到office 365 用户管理界面
  需要先安装登陆助手及Azure AD模块
  在windows powershell 下运行:
  Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned    //更改执行策略,执行一次就够了
$credential = Get-Credential    //创建凭据
$credential    //验证凭据
*连接到office365上面(首先要导入模块,安装登录助手,Azure AD模块)
*注意要是安装好了Azure Adconnect 的时候,先决条件会自动安装成功
Import-Module MsOnline    //导入office365模块
Get-Module    //验证是否导入模块 ,若是返回Manifest   MSOnline                            {Add-MsolAdministrativeUnitMe… 即是导入模块成功
Connect-MsolService -Credential $credential    //连接到office365上面
Get-MsolDomain
  或者采用综合代码



$User = "admin@conston.partner.onmschina.cn"
$PWord = ConvertTo-SecureString –String "password" –AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User,$Pword
Import-Module MsOnline
Connect-MsolService -Credential $Credential
  2.使用Powershell 链接到office 365 Exchange Online 管理界面
  在windows powershell 下运行:
  Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential //(获取office365的登录凭据)
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://partner.outlook.cn/PowerShell -Credential $UserCredential -Authentication Basic –AllowRedirection   // 国际版本URL为; https://outlook.office365.com/powershell-liveid/
Import-PSSession $Session
  或者采用综合代码
页: [1]
查看完整版本: 使用Powershell链接到Office 365