在Office 365 添加就地保留用户邮箱

基于客户需求,要求将用户批量添加到Office 365中的现有就地保留。如您所了解的,我们可以通过Exchange在线图形用户GUI界面完成,也可以通过PowerShell完成。

要将用户批量添加到Office 365中的现有就地保留,您需要连接Exchange online PowerShell

$UserCred= Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionURI https://outlook.office365.com/powershell-liveid/ -Credential $UserCred -Authentication Basic -AllowRedirection

Import-PSSession $Session

clip_image001[38]

Exchange Online PowerShell连接后。下一步是将邮箱添加到我们的邮箱搜索

#1列出现有邮箱搜索中的所有邮箱

$InPlaceHoldMBX = (Get-MailboxSearch “InPlaceHold”).SourceMailboxes

#2将其他邮箱添加到现有列表中。您可以使用UPN,电子邮件或任何其他用户标识符来唯一标识用户。

$InPlaceHoldMBX += “user Identifier”

#3将用户添加到现有的InPlace 列表

Set-MailboxSearch “InPlaceHold” -SourceMailboxes $InPlaceHoldMBX -InPlaceHoldEnabled $true
  • 将用户添加到就地保留后,您可以导出添加到就地保留的用户列表
PS cmdlet “(Get-MailboxSearch “InPlaceHold”).SourceMailboxes“
  • 将邮箱添加到就地保留后关闭PowerShell连接
Get-PSSession | Remove-PSSession

clip_image002[12]

原文地址:https://www.cnblogs.com/Aldj/p/8607004.html