Avatar of rilliam
rilliam
Flag 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?
Exchange

Avatar of undefined
Last Comment
rilliam

8/22/2022 - Mon
SOLUTION
LegendZM

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
LegendZM

example:

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

or something like that

They give more examples on the page.
rilliam

ASKER
export-mailbox require a seperate server running 32bit and outlook? Or is that just to export to PST?
LegendZM

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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
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?
LegendZM

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
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
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
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
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
LegendZM

Get-User tester4 | Export-Mailbox -SubjectKeywords * -DeleteContent

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

Something like that, give that a shot.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
LegendZM

Don't do the mailbox one with the -database switch that would wipe everyone's mailbox.
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
LegendZM

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

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
LegendZM

or something like

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

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
rilliam

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.