为托管文件夹使用 Exchange 命令行管理程序脚本

 

适用于: Exchange Server 2010 SP2, Exchange Server 2010 SP3

上一次修改主题: 2011-04-28

可使用命令行管理程序 cmdlet 和脚本管理 MicrosoftExchange Server 2010 中的邮件记录管理 (MRM)。我们建议您先在非生产环境中测试 MRM 功能。准备在生产中实现 MRM 时,可以使用生产环境中的相同脚本来准确、一致地复制托管文件夹、托管内容设置和托管文件邮箱策略。

注释注意:
托管自定义文件夹是 MRM 的一项高级功能。每个具有托管自定义文件夹的邮箱都需要 Exchange Server Enterprise 客户端访问许可证 (CAL)。如果邮箱的策略包括托管自定义文件夹,则该邮箱需要 Exchange Server Enterprise CAL。

使用命令行管理托管文件夹

您必须先获得权限,然后才能执行此过程。若要查看所需的权限,请参阅邮件策略和遵从性权限主题中的“邮件记录管理”条目。

  1. 通过在文本编辑器中输入命令行命令创建脚本,如下面的示例脚本所示。

  2. 用 .ps1 文件扩展名保存脚本的文本文件(例如 MRM_Sample_Script.ps1)。

  3. 在命令行的命令提示符下,输入脚本的路径和文件名(例如 C:\Scripts\MRM_Sample_Script.ps1.\MRM_Sample_Script.ps1,用于工作目录中的脚本)。

下面是一个 MRM 的示例脚本。有关所执行操作的说明,请参阅脚本中的注释。

# MRM_Sample_Script.ps1

# This script demonstrates the fundamentals of performing messaging records management by running scripts in the Exchange Management Shell.

# Create a new managed custom folder.
New-ManagedFolder -Name "Important E-mail" -FolderName "Business Folder A" 

# Create a variable, \"$age,\" to use in the next command.
$age = New-TimeSpan -Day 30

# Create managed content settings for the new managed custom folder that delete items after 30 days.
New-ManagedContentSettings -Name "Retention settings for Business Folder A" -FolderName "Business Folder A" -MessageClass VoiceMail -RetentionEnabled:$true -AgeLimitForRetention $Age -RetentionAction PermanentlyDelete

# Create a managed folder mailbox policy.
New-ManagedFolderMailboxPolicy -Name "Business Folder A" -ManagedFolderLinks "Important E-mail"

# Apply the managed folder mailbox policy to a mailbox.
Set-Mailbox -Identity Administrator -ManagedFolderMailboxPolicy "Business Folder A"

# Schedule the Managed Folder Assistant to run the entire week.
$ServerName= cmd /c echo %computername%
Set-MailboxServer -ID $ServerName -ManagedFolderAssistantSchedule "Sun.12:00-Sun.11:00"

# Start the Managed Folder Assistant. 
Start-ManagedFolderAssistant

 © 2010 Microsoft Corporation。保留所有权利。