New-ManagementRoleAssignment –Role “Mailbox Import Export” –User contoso\Administrator 给administrator赋权,否则在下面运行Search-Mailbox的时候会无法识别该命令,此处与 Exchange 2007 有所不同。
Get-mailbox | Add-MailboxPermission -User administrator -AccessRights Fullaccess 赋权administrator对所有邮箱的完全访问权限。
[PS] C:\Windows\system32>Get-Mailbox -Database Test -ResultSize Unlimited | Search-Mailbox -SearchQuery "Received:2012-01-01..2012-03-09" -DeleteContent -Confirm
如果出现search-mailbox提示无效请运行一些命令,将Exchagne管理的控制台导入Exchagne2010中:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010