TechShizz | All posts tagged 'Exchange 2010'

Recover Deleted Mailbox Items

If you ever need to export just the recoverable deleted items, and the retrievable purged items, for a mailbox you can run the following command in EMS 2010 onwards:

New-MailboxExportRequest -mailbox USER.NAME -FilePath \\servername\folderlocation\MUSTSPECIFYPSTNAME.pst -IncludeFolders "Recoverable Items"

A good guide:



To search for items you need to have the "Discovery Management" built-in role group permission.


To add the permission via EMS use:

Add-RoleGroupMember "Discovery Management" -Member <user account>


Or use AD.




Search-Mailbox UserA -SearchQuery "from:'boss' AND seattle" -TargetMailbox "Discovery Search Mailbox" -TargetFolder "FolderA" -LogLevel Full


The email then appears in the folder structure.


Export Mailbox to PST

Before you can export/import you need to assign the permission to do this to a custom management role. See Technet:




This was also useful:


Applies to Exchange 2010 SP2 +


There are two ways to do this:

  1. You can either create a Universal Security group and then make that the group which allows access to a user to be able to Import/export in exchange


Create the group in AD (Named "Enterprise Support" in this example)


New-ManagementRoleAssignment -Name "Import Export_Enterprise Support" -SecurityGroup "Enterprise Support" -Role "Mailbox Import Export"



  1. Apply the users to the Management Role Assignment group and there will be not security group.



Add the admin to the Management Role Assignment


New-ManagementRoleAssignment –Role "Mailbox Import Export" –User John






To export a mailbox into a PST file:


New-MailboxExportRequest -Mailbox AylaKol -FilePath \\MBX-01\PSTFileShare\Ayla_Recovered.pst


From <>




To export a specific date range:


New-MailboxExportRequest -Mailbox Rich -ContentFilter {(Received -lt '01/01/2010') -and (Received -gt '01/01/2009')} -FilePath \\MBX-01\PSTFileShare\Ayla_Recovered.pst


From <>



Content Filters


Has attachment -

-ContentFilter {HasAttachment -eq $true}


Received - (date must be MM/DD/YYYY)

-ContentFilter {(Received -lt '01/01/2010') -and (Received -gt '01/01/2009')}


Subject -

-ContentFilter {Subject -like '*meeting*'}

What if it Failed?

Add the switch -BadItemLimit Unlimited -AcceptLargeDataLoss. 

You can get a detailed report on why the exports fail with this command. 

Get-MailboxExportRequest -status failed | Get-MailboxExportRequestStatistics -IncludeReport | Format-List > c:\report.txt

Exchange mailbox repair (scan check)

New-MailboxRepairRequest -Mailbox jon.jones -CorruptionType SearchFolder,AggregateCounts,ProvisionedFolder,FolderView

then to view the status of the repair: (exchange 2013+ only, otherwise you need to check the application event log for the completion status. In my experience it completes < 10 minutes)

Get-MailboxRepairRequest -Mailbox big.dave | FL

White-list a domain in Exchange

$WhiteDomain = (Get-ContentFilterConfig).BypassedSenderDomains


Set-ContentFilterConfig -BypassedSenderDomains $WhiteDomain

Transport Rules

We can create a transport rule to do many different actions to the scoped mail type.


For example we can add a disclaimer to all email that leaves the organization.


Transport Rule Actions are applied when the messages match the conditions but no exceptions.


For a full list of actions type


Get-TransportRuleAction | FL


The output may be different depending on if this is run on the Hub Transport or the Edge Transport Server.



The following command creates the transport rule TransportRuleExample, which adds Kim Akers to the

recipients of any email messages sent to Mark Harrington except for messages that are sent by the external user


New-TransportRule –Name TransportRuleExample –SentTo "Mark Harrington" –AddToRecipients

"Kim Akers" –ExceptIfFrom



Active Directory stores transport rules that are configured on Hub Transport servers so

that these transport rules are accessible to all Hub Transport servers in the organization

through Active Directory replication.


Transport rules that are configured on Edge Transport servers are stored in Active Directory Lightweight Directory Services (AD LDS) - Rules configured on one Edge Transport server do not automatically replicate to other Edge Transport servers in an Exchange organization.

Edge server transport rules apply to all types of message, cannot expand distribution group membership, cannot access Active Directory attributes, and cannot inspect or modify IRM-protected message content.