TechShizz | All posts tagged 'Exchange 2010'

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: https://technet.microsoft.com/en-gb/library/ee633452(v=exchg.141).aspx

 

Also:

https://technet.microsoft.com/en-us/library/ff459227(v=exchg.141).aspx

 

This was also useful:

http://serverfault.com/questions/386104/error-in-new-mailboxexportrequest-couldnt-find-the-enterprise-organizational

 

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

 

 

====================================================

EMS MUST BE RUN AS ADMINISTRATOR

 

To export a mailbox into a PST file:

 

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

 

From <https://technet.microsoft.com/en-us/library/ff459227(v=exchg.141).aspx>

 

====================================================

EMS MUST BE RUN AS ADMINISTRATOR

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 <https://technet.microsoft.com/en-us/library/ff601762(v=exchg.141).aspx>

 

 

Content Filters

 

https://technet.microsoft.com/en-us/library/ff601762(v=exchg.141).aspx

 

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

 

https://technet.microsoft.com/en-us/library/ff625226%28v=exchg.160%29.aspx?f=255&MSPPError=-2147217396

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:

http://blogs.technet.com/b/exchange/archive/2010/04/26/item-recovery-in-exchange-2010.aspx

 

 

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.

 

Searching:

 

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

 

The email then appears in the folder structure.


ECP

Merging mailboxes

To merge a mailbox with another we can Export then Import pst files and then change it's address to follow the source account.

 

Steps to Follow:

Export the X500 Addresses of the address that receives the email

Change the SMTP address on the source account to something else

Change the SMTP address on the target account to the new address

Export the pst

Delete the old account

Import the pst

Make the SMTP on the new account primary.

Get permissions for all mailboxes


$OutFile = "C:\Temp\PermissionExport.txt"

"DisplayName" + "^" + "Alias" + "^" + "Full Access" + "^" + "Send As" | Out-File $OutFile -Force

$Mailboxes = Get-Mailbox -RecipientTypeDetails usermailbox -ResultSize:Unlimited | Select Identity, Alias, DisplayName, DistinguishedName

ForEach ($Mailbox in $Mailboxes) {

$SendAs = Get-ADPermission $Mailbox.DistinguishedName | ? {$_.ExtendedRights -like "Send-As" -and $_.User -notlike "NT AUTHORITY\SELF" -and !$_.IsInherited} | % {$_.User}

$FullAccess = Get-MailboxPermission $Mailbox.Identity | ? {$_.AccessRights -eq "FullAccess" -and !$_.IsInherited} | % {$_.User}

$Mailbox.DisplayName + "^" + $Mailbox.Alias + "^" + $FullAccess + "^" + $SendAs | Out-File $OutFile -Append

};