Solved

Exchange 2007 - Export to CSV shell command

Posted on 2013-06-21
5
592 Views
Last Modified: 2013-06-24
Each mailbox has emails that are tagged with a phrase "This message has been automatically saved and archived". I need to find the number of emails for every mailbox and export that to and .csv file. In the end, I would like to have a .csv file with the mailbox account and the number of messages that matches the phrase.

What command can I use in shell to achieve this?
0
Comment
Question by:namido
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 12

Accepted Solution

by:
Julian123 earned 500 total points
ID: 39267066
There is no one single command that will give you what you need, but you can get it with a combination of a few. Here's how I would do it:

1. Create a new mailbox.
2. Use the export-mailbox command on each mailbox and configure it to filter based on the phrase you want. You can run the sun multiple mailboxes using get-mailbox | export-mailbox. The exact syntax for the command can be found here: http://technet.microsoft.com/en-us/library/aa998579(v=EXCHG.80).aspx. The results will be that a copy of each of those items will be made in the new mailbox.
3. Run the get-mailboxstatistics command on the new mailbox. That will give you count of all items in the mailbox. Since the only items you've placed there are those you copied in the previous step, that count should match the number of items you found.
0
 

Author Comment

by:namido
ID: 39267251
Will this separate each mailbox? It looks like the get-mailboxstatistics will only give me results from the new mailbox created.
0
 
LVL 12

Expert Comment

by:Julian123
ID: 39267269
If you need that, you can use export-mailbox to put items in separate folders in #2 above. You can then run get-mailboxFOLDERstatistics to get the per-folder account in #3.
0
 

Author Comment

by:namido
ID: 39267353
Could you give me an example of the syntax you would use? Catching and separating the mailbox and phrase is what I'm struggling with.
0
 
LVL 12

Expert Comment

by:Julian123
ID: 39267373
Here's an example:

Export-Mailbox -Identity contoso\john -TargetMailbox MyMailbox -TargetFolder MyData -ContentKeywords "mykeyword"

Full details here: http://technet.microsoft.com/en-us/library/aa998579(v=EXCHG.80).aspx
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question