Link to home
Start Free TrialLog in
Avatar of rilliam
rilliamFlag for United States of America

asked on

Purge / Empty mailbox without outlook

I would like to simply empty a mailbox of all its contents. Is this possible?
SOLUTION
Avatar of LegendZM
LegendZM
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
example:

Get-Mailbox Database MailStore1 | Export-Mailbox -TargetMailbox MailBox -SubjectKeywords * -DeleteContent

or something like that

They give more examples on the page.
Avatar of rilliam

ASKER

export-mailbox require a seperate server running 32bit and outlook? Or is that just to export to PST?
I believe that's just to export to PST, if not, you can download and install the 32bit Exchange / powershell and install it on your machine, and then install Exchange Powershell Tools on your machine.

download exch 07 32bit here:
http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=44c66ad6-f185-4a1d-a9ab-473c1188954c&displaylang=en
Avatar of rilliam

ASKER

In that page it says export to FOLDER. I don't understand what FOLDER means, is that a folder in the file system or a folder in the mailbox?
It could be the folder in the system or a folder in the mailbox, it depends which switch your talking about.

This page breaks down the commands in a lot more detail, read this:

http://technet.microsoft.com/en-us/library/bb266964.aspx
Avatar of rilliam

ASKER

[PS] C:\Documents and Settings\Administrator.test>Get-User tester4 | Export-
Mailbox -TargetMailbox ExportMailbox -TargetFolder MyData -SubjectKeywords * -De
leteContent

Confirm
Are you sure you want to perform this action?
Exporting mailbox content from the mailbox 'tester4' into the mailbox for
'ExportMailbox (ExportMailbox@test.com)' inside folder '\MyData\Recovered
Data - tester4 - 7/17/2008 2:36:48 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 tester4 (tester4@test.com) because: Er
ror occurred in the step: Creating target folder in the target mailbox. An unkn
own error has occurred., error code: -2147221233
At line:1 char:34
+ Get-User tester4 | Export-Mailbox  <<<< -TargetMailbox ExportMailbox -TargetF
older MyData -SubjectKeywords * -DeleteContent
Avatar of rilliam

ASKER

[PS] C:\Documents and Settings\Administrator.test>Get-User tester4 | Export-
Mailbox -DeleteContent

Confirm
Are you sure you want to perform this action?
Searching the contents and/or the associated messages from the mailbox
'tester4' and deleting those messages that meet the criteria specified. 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 tester4 (tester4@test.com) because: Er
ror occurred in the step: Moving messages. Failed to copy messages to the desti
nation mailbox store with error:
MAPI or an unspecified service provider.
ID no: 00000000-0000-00000000, error code: -1056749164
At line:1 char:34
+ Get-User tester4 | Export-Mailbox  <<<< -DeleteContent
Avatar of rilliam

ASKER

[PS] C:\Documents and Settings\Administrator.xyz>Export-Mailbox -Identity t
ester4 -DeleteContent

Confirm
Are you sure you want to perform this action?
Searching the contents and/or the associated messages from the mailbox
'tester4' and deleting those messages that meet the criteria specified. 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 tester4 (test@domain.com) because: Er
ror occurred in the step: Moving messages. Failed to copy messages to the desti
nation mailbox store with error:
MAPI or an unspecified service provider.
ID no: 00000000-0000-00000000, error code: -1056749164
At line:1 char:15
+ Export-Mailbox  <<<< -Identity test -DeleteContent
Get-User tester4 | Export-Mailbox -SubjectKeywords * -DeleteContent

Get-mailbox -database 'DB1' | export-mailbox -SubjectKeywords * -DeleteContent

Something like that, give that a shot.
Don't do the mailbox one with the -database switch that would wipe everyone's mailbox.
Avatar of rilliam

ASKER

Doesn't work either.

[PS] C:\Documents and Settings\Administrator.test>Get-User tester4 | Export-
Mailbox -SubjectKeywords * -DeleteContent

Confirm
Are you sure you want to perform this action?
Searching the contents and/or the associated messages from the mailbox
'tester4' and deleting those messages that meet the criteria specified. 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 tester4 (tester4@test.com) because: Er
ror occurred in the step: Moving messages. Failed to copy messages to the desti
nation mailbox store with error:
MAPI or an unspecified service provider.
ID no: 00000000-0000-00000000, error code: -1056749164
At line:1 char:34
+ Get-User tester4 | Export-Mailbox  <<<< -SubjectKeywords * -DeleteContent
Ok so you need a temporary place to put the files, but the box must exist.


Get-User test4 | Export-Mailbox -TargetMailbox RealMailboxName -TargetFolder Inbox -SubjectKeywords * -DeleteContent

or something like

Export-Mailbox -Identity domain\user -TargetMailbox MustBerealmailbox -TargetFolder Realfolderinmailbox -subjectkeywords * -deletecontent

Avatar of rilliam

ASKER

Please see my third post I tried that already with another targetfolder. Here is what I get when I do inbox:

[PS] C:\Documents and Settings\Administrator.test>Get-User tester4 | Export-
Mailbox -TargetMailbox ExportMailbox -TargetFolder Inbox -SubjectKeywords * -Del
eteContent
Export-Mailbox : The target folder 'Inbox' is a special folder of target mailbo
x 'ExportMailbox', and is not supported by this command.
At line:1 char:34
+ Get-User tester4 | Export-Mailbox  <<<< -TargetMailbox ExportMailbox -TargetF
older Inbox -SubjectKeywords * -DeleteContent
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial