Prb with Export-Mailbox cmdlet
The following command is supposed to find email that was inadvertently sent, but that needs to be deleted from inboxes.I started testing it without the -DeleteContent parameter that actually deletes the message. [PS] C:\>Get-MailboxDatabase "MBXDB1" | Export-Mailbox -TargetMailbox ExportMBX -TargetFolder Exported -SubjectKeywords "TOP-SECRET!" Export-Mailbox : The specified user "MSERV01\SG1\MBXDB1" could not be found. [...] WHY DOES IT WANT A SINGLE USER? OK, let's try a single user (not that this would be practical for the desired operation): [PS] C:\>Get-Mailbox hlaporte | Export-Mailbox -TargetMailbox ExportMBX -TargetFolder Exported -SubjectKeywords "TOP-SECRET!" Confirm Are you sure you want to perform this action? Exporting mailbox content from the mailbox 'Hormidas Laporte' into the mailbox for 'ExportMBX (EMAIL REMOVED)' inside folder '\Exported\Recovered Data - Hormidas Laporte - 10/4/2009 3:45:59 PM'. This operation may take a long time to complete. [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):y Export-Mailbox : Error was found for Hormidas Laporte (EMAIL REMOVED) because: Error occurred in the step: Creating target folder in the target mailbox. An unknown error has occurred., error code: -2147221233 At line:1 char:38 + Get-Mailbox hlaporte | Export-Mailbox <<<< -TargetMailbox ExportMBX -TargetFolder Exported -SubjectKeywords "TOP-SECRET!" I create the target folder manually... Are you sure you want to perform this action? Exporting mailbox content from the mailbox 'Hormidas Laporte' into the mailbox for 'ExportMBX (EMAIL REMOVED)' inside folder '\Exported\Recovered Data - Hormidas Laporte - 10/4/2009 3:49:04 PM'. This operation may take a long time to complete. [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):y Export-Mailbox : Error was found for Hormidas Laporte (EMAIL REMOVED) becau se: Error occurred in the step: Creating target folder in the target mailbox. An unknown error has occurred., error code: -2147221233 At line:1 char:38 + Get-Mailbox hlaporte | Export-Mailbox <<<< -TargetMailbox ExportMBX -TargetFolder Exported -SubjectKeywords "TOP-SECRET" I tried letting the command create a TargetFolder of a different name. Same error. Tried this too: [PS] C:\>Export-Mailbox hlaporte -TargetMailbox ExportMBX -TargetFolder "Export" -SubjectKeywords "TOP-SECRET" Confirm Are you sure you want to perform this action? Exporting mailbox content from the mailbox 'Hormidas Laporte' into the mailbox for 'ExportMBX (EMAIL REMOVED)' inside folder '\Export\Recovered Data - Hormidas Laporte - 10/4/2009 4:07:51 PM'. This operation may take a long time to complete. [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):a Export-Mailbox : Error was found for Hormidas Laporte (EMAIL REMOVED) because: Error occurred in the step: Creating target folder in the target mailbox. An unknown error has occurred., error code: -2147221233 At line:1 char:15 + Export-Mailbox <<<< hlaporte -TargetMailbox ExportMBX -TargetFolder "Export" -SubjectKeywords "TOP-SECRET"Does anyone know how to make this work?Thank you in advance!
October 5th, 2009 4:17pm

Below cmdlet pipe the output of mailbox database to Export-Mailbox cmdlet which is not possible. Get-MailboxDatabase "MBXDB1" | Export-Mailbox -TargetMailbox ExportMBX-TargetFolder Exported -SubjectKeywords "TOP-SECRET!" Actual cmdlet would be like below to get the list of all mailboxes of database MBXDB1 and pipe the output to Export-Mailbox.. Get-Mailbox -Database "MBXDB1" | Export-Mailbox -TargetMailbox ExportMBX-TargetFolder Exported -SubjectKeywords "TOP-SECRET!" Error 2147221233 says account might not have permission to create folder in target mailbox. Is the account member of any AD Admin groups which you are using for Export-Mailbox? How to Export Mailbox Data http://technet.microsoft.com/en-us/library/bb266964.aspxAmit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
October 5th, 2009 4:53pm

I think Amit is correct - this is a permissions issue. The account you are using to export needs to have the correct permissions on the mailbox.Exchange 2007 SP1 permissions model:http://technet.microsoft.com/en-us/library/aa996881.aspx
October 5th, 2009 6:20pm

I'll take a look at this tonight. User in question should be member of all necessary admin groups though.
Free Windows Admin Tool Kit Click here and download it now
October 5th, 2009 8:19pm

Well, AD Admin groups like Domain and Enterprise admins have inherited Deny Receive-As permission which may cause accessing mailbox so it would be better to use a user account which is not member of AD Admin groups and make sure that it has just below permissions... Exchange Server Administrators role and local Administrators group for the source server and the target server Full access to the source and target mailboxes Amit Tank | MVP – Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
October 6th, 2009 6:48am

Amit,Thanks. I did the following but did not see your comments about admin groups until later - so I'll try again tonight with a different account.whoami /groups Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group BUILTIN\Administrators Alias S-1-5-32-544 Mandatory group, Enabled by default, Enabled group, Group owner NT AUTHORITY\INTERACTIVE Well-known group S-1-5-4 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group LOCAL Well-known group S-1-2-0 Mandatory group, Enabled by default, Enabled group CONTOSO\Group Policy Creator Owners Group S-1-5-21-2701690964-38301045-3110237400-520 Mandatory group, Enabled by default, Enabled group CONTOSO\Domain Admins Group S-1-5-21-2701690964-38301045-3110237400-512 Mandatory group, Enabled by default, Enabled group CONTOSO\Schema Admins Group S-1-5-21-2701690964-38301045-3110237400-518 Mandatory group, Enabled by default, Enabled group CONTOSO\Enterprise Admins Group S-1-5-21-2701690964-38301045-3110237400-519 Mandatory group, Enabled by default, Enabled group CONTOSO\Exchange View-Only Administrators Group S-1-5-21-2701690964-38301045-3110237400-1111 Mandatory group, Enabled by default, Enabled group CONTOSO\Exchange Public Folder Administrators Group S-1-5-21-2701690964-38301045-3110237400-1112 Mandatory group, Enabled by default, Enabled group CONTOSO\Exchange Recipient Administrators Group S-1-5-21-2701690964-38301045-3110237400-1110 Mandatory group, Enabled by default, Enabled group CONTOSO\Exchange Organization Administrators Group S-1-5-21-2701690964-38301045-3110237400-1109 Mandatory group, Enabled by default, Enabled group Mandatory Label\High Mandatory Level Unknown SID type S-1-16-12288 Mandatory group, Enabled by default, Enabled group I see that membership in groups in bold could be a problem (your last post). I tried the command you suggested yesterday with these results (but as I said, I'll try tonight with a different account):[PS] C:\>Export-Mailbox gtremblay -TargetMailbox ExportMBX -TargetFolder Export -SubjectKeywords "SECRET" Confirm Are you sure you want to perform this action? Exporting mailbox content from the mailbox 'Gerard Tremblay' into the mailbox for 'ExportMBX (EMAIL REMOVED)' inside folder '\Export\Recovered Data - Gerard Tremblay - 10/5/2009 6:49:19 PM'. This operation may take a long time to complete. [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):aExport-Mailbox : Error was found for Gerard Tremblay (EMAIL REMOVED) because: Error occurred in the step: Creating target folder in the target mailbox. An unknown error has occurred., error code: -2147221233 At line:1 char:15 + Export-Mailbox <<<< gtremblay -TargetMailbox ExportMBX -TargetFolder Export -SubjectKeywords "SECRET"
Free Windows Admin Tool Kit Click here and download it now
October 6th, 2009 8:03pm

OK.I tried as a user that was member of Exchange Organization Admins (among others) but NOT Domain, Enterprise, or Schema admin.Still failed.Then I granted that user Full Access to mailbox.That worked perfectly. So it was indeed a permissions issue.
October 8th, 2009 4:05pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics