How to Use Exchange Management Shell Scripts for Messaging Records Management
Microsoft Exchange Server 2007 will reach end of support on April 11, 2017. To stay supported, you will need to upgrade. For more information, see Resources to help you upgrade your Office 2007 servers and clients.
Applies to: Exchange Server 2007, Exchange Server 2007 SP1, Exchange Server 2007 SP2, Exchange Server 2007 SP3
This topic explains how to use scripts in the Exchange Management Shell to manage messaging records management (MRM) in Microsoft Exchange Server 2007.
Before You Begin
To perform this procedure, the account you use must be delegated the following:
- Exchange Organization Administrator role
For more information about permissions, delegating roles, and the rights that are required to administer Exchange Server 2007, see Permission Considerations.
Note
Managed custom folders are a premium feature of MRM. Each mailbox that has managed custom folders requires an Exchange Server Enterprise client access license (CAL). Mailboxes with policies that include managed custom folders require an Exchange Server Enterprise CAL. To learn more about the licensing requirements for MRM, see "Client Access Licenses and MRM" in Understanding Messaging Records Management.
Procedure
To use the Exchange Management Shell to manage messaging records management
Create a script by entering Exchange Management Shell commands in a text editor, as shown in the sample script that follows.
Save the text file for the script with the .ps1 file extension (for example, MRM_Sample_Script.ps1).
At the command prompt of the Exchange Management Shell, enter the path and file name of the script (for example, C:\Scripts\MRM_Sample_Script.ps1, or .\MRM_Sample_Script.ps1 for a script in the working directory).
Sample Script
The following is a sample script for messaging records management. For an explanation of the actions performed, see the comments within the script.
# 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 "Policy 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
For More Information
For more information about messaging records management, see the following topics:
For more information about how to use the Exchange Management Shell commands to manage your Exchange 2007 organization, see New Administration Functionality in the Exchange Management Shell.
For more information about using scripts with the Exchange Management Shell, see Scripting with the Exchange Management Shell.