Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Scanning a mailbox and summarising message classes

Created: 26 Mar 2012 • Updated: 29 Mar 2012 | 14 comments
Rob.Wilcox's picture
+3 3 Votes
Login to vote

Here is a script which will scan a particular mailbox through the default mailbox profile, and report on the structure it finds, along with the distribution of messages per message class.

The output looks like this :

 Microsoft (R) Windows Script Host Version 5.7

Copyright (C) Microsoft Corporation. All rights reserved.


Processing started at : 3/26/2012 11:32:38 AM

Scanning mailbox : jeff1

-------------------------------------

Top of Information Store : 0

  1Year : 0

  1Year-testsubs : 1

      s1 : 1

  Calendar : 2

  Contacts : 1

  Conversation Action Settings : 0

  Deleted Items : 9

  Drafts : 0

  Inbox : 199

      100 items 2 : 4

      1000 items : 9

      EVArchiveSize : 0

      modified ret cat : 10

      s2 : 3

  Journal : 0

  Junk E-mail : 17

  News Feed : 0

  Notes : 0

  Outbox : 0

  Private1 : 0

  Quick Step Settings : 0

  RSS Feeds : 0

  Sent Items : 60

  Suggested Contacts : 0

  Sync Issues : 0

      Conflicts : 0

      Local Failures : 0

      Server Failures : 0

  Tasks : 0

  x1 : 0

      J123 : 1

      Personal Folders : 0

            t1 : 19

      Personal Folders 1 : 0

                  alpha1 : 1

      Personal Folders 2 : 0

                        jongo1 : 2

---------------------------------------

Number of items in the mailbox : 339

Total size : 2425513 Bytes, 2368.67 Kbytes, 2.31 Mb

Number of archived items : 250

Archived items size : 473986 Bytes, 462.88 Kbytes, 0.45 Mb

Number of pending items : 0

Pending items size : 0 Byes, 0 Kbytes, 0 Mb

---------------------------------------


Summary by Message Class:


IPM.NOTE.ENTERPRISEVAULT.SHORTCUT - 1 - Size: 1784 bytes, 0 Mb

IPM.NOTE - 250 - Size: 473919 bytes, 0.45 Mb

IPM.APPOINTMENT - 85 - Size: 1124774 bytes, 1.07 Mb

IPM.CONTACT - 1 - Size: 536 bytes, 0 Mb

IPM.NOTE.SHANGY - 1 - Size: 819485 bytes, 0.78 Mb


Processing finished at : 3/26/2012 11:32:38 AM 
 
Further info:
 
  • Save the attachment to this post as a .vbs file.
  • Remember to edit it to put in the name of the Exchange server and mailbox for your environment.
  • Run it using : cscript scanner.vbs, from a DOS command prompt
  • Remember it uses CDO.   (Which isn't installed by default on Outlook 2007+)

Comments 14 CommentsJump to latest comment

TypoProne's picture

Thanks Rob. Love the scripts you provide us. ANy idea on impact, time, transaction log growth in Exchange or anything like that?

+1
Login to vote
Rob.Wilcox's picture

You are welcome.

I've not done any kind of exhaustive testing, but ...

Impact -> Similar to if a user were logging in and creating a cached mode Outlook profile.  Every mail item, in every folder will be touched one time.

Time -> I have a mailbox with 10,250 items in it.  To scan that took : 26 seconds.  I also have a mailbox with 20,250 items in it.  To scan that took : 41 seconds

TL Growth -> None, since it's reads of the Exchange store.  At least there 'shouldn't be any'.  In my *brief* testing, I didn't see any logs created whilst scanning the 10,000 item mailbox nore the 20,000 item mailbox.

It could be made more efficient, by using Redemption for example.  This is just 'simple' CDO stuff.

+1
Login to vote
ajeje_brazor's picture

yesThanks Rob! yes

However, it is not clear how come can be different:

- the number (and size) of "pending items"

- the "PENDING" EV message class.

Please, have a look at the report performed in my POC:

Number of pending items : 856

Pending items size : 2554903 Byes, 2495.02 Kbytes, 2.44 Mb

---------------------------------------

Summary by Message Class:

IPM.NOTE.ENTERPRISEVAULT.PENDINGARCHIVE - 1 - Size: 3387 bytes, 0 Mb

IPM.NOTE.ENTERPRISEVAULT.PENDINGARCHIVE.ARCHIVEME - 2 - Size: 4419 bytes, 0 Mb

Am I missing something? indecision

+1
Login to vote
Rob.Wilcox's picture

Looks like you have discovered a bug ..  how rude of me to include one ;-)

The problem is around this:

while found = false and i<mbxmsgclass_array_i
          if mbxmsgclass_array(i,1) = msgclassname then
                   found = true
         end if
          i = i + 1
wend

It should be :

while found = false and i<mbxmsgclass_array_i
        if mbxmsgclass_array(i,1) = msgclassname then
             found = true
       else
             i = i + 1
       end if
wend
 
With it set how it was ... I got this sort of output :
 
Number of items in the mailbox : 20250
Total size : 115949628 Bytes, 113232.06 Kbytes, 110.58 Mb
Number of archived items : 0
Archived items size : 0 Bytes, 0 Kbytes, 0 Mb
Number of pending items : 29
Pending items size : 160513 Byes, 156.75 Kbytes, 0.15 Mb
---------------------------------------
 
Summary by Message Class:
 
IPM.NOTE - 1 - Size: 5732 bytes, 0.01 Mb
IPM.NOTE.ENTERPRISEVAULT.PENDINGARCHIVE - 15005 - Size: 85917787 bytes, 81.94 Mb
 
 
Which is of course, wrong!
 
And with it corrected :
 
Number of items in the mailbox : 20250
Total size : 115949628 Bytes, 113232.06 Kbytes, 110.58 Mb
Number of archived items : 0
Archived items size : 0 Bytes, 0 Kbytes, 0 Mb
Number of pending items : 29
Pending items size : 160513 Byes, 156.75 Kbytes, 0.15 Mb
---------------------------------------
 
Summary by Message Class:
 
IPM.NOTE - 20221 - Size: 115789115 bytes, 110.43 Mb
IPM.NOTE.ENTERPRISEVAULT.PENDINGARCHIVE - 29 - Size: 160513 bytes, 0.15 Mb
 
Processing finished at : 3/28/2012 9:20:47 AM
 
And this is correct.
 
Just going to update the script now.
 
Edit: SCRIPTED UPDATED
+1
Login to vote
Adrian_Ryan's picture

Hi there, looks like this script could be really useful. However, when I try and run it I get:

c:\Scripts\Scan_mailbox.wsf(138, 2) Windows Script Host: Unterminated entity ref
erence - matching ';' not found

Any ideas??

Cheers

Adrian

+1
Login to vote
Rob.Wilcox's picture

Yep.. it's not a WSF file.

It's vbscript.  I've updated the instructions at the top post.

+1
Login to vote
fordpw's picture

Rob, 

BTW - Great post! 

I'm looking for some documentation on an api to access EV. I noticed you used CDO here and vbscript. Can you please point me to any documentation that lists the api, use, files, etc; ?

I am a consultant trying to build a migration tool for EV. Currently do not have access to EV but need to read up on api, integration and other EV programming topics.

Any help would be awesome.

thanks

paul

paul.ford@mavenwave.com

0
Login to vote
Rob.Wilcox's picture

Hi Paul,

EV does indeed have an API (or two).  There is an API for searching content in EV, and an API for doing 'stuff' with content, ie ingesting new content.

Both of these are covered in the API guide, but in order to get that you need to be a registered with STEP (which I think is Symantec Technology Enabled Partner)... and it costs a fair amount of money.

There are plenty of partners that lurk on the boards here, who you could contact for more information, or, if there is a general request, then you could post the question in the forums.

I'd suggest before leaping in though, that you need a reasonable knowledge of EV.

Hope that helps,

0
Login to vote
hubbardt's picture

Does this script work for Outlook 2010 ? (32-bit)

I ran it without installing CDO and get " Microsoft VBScript runtime error: ActiveX component can't create object: 'MAPI.Session' "

If I try and install CDI I get "Collaboration Data Objects 1.2.1 cannot be installed unless Microsoft Office Outlook 2007 is also installed"

Thank you

0
Login to vote
TypoProne's picture

This is not my script but I do not think it will work against that version of Outlook. Same reasons that EV does not, BES does not, and pretty much any other MAPI driven utility requires Outlook 2007 or prior.

+1
Login to vote
Rob.Wilcox's picture

to hubbardt, yes you need Outlook 2007 or earlier.

Some of the scripts that I'm doing now are using the Redemption library, which gets around the Outlook version issue, and doesn't use CDO at all.

0
Login to vote
modemis's picture

Hi Rob.

I have Windows 2008 R2 Enterprise server (x64) with Outlook 2007 SP3 and have installed CDO 1.2.1 successfully. However, when I try to run your script using cscript scanner_new.vbs, I get the following error no matter what I do.

 "Microsoft VBScript runtime error: ActiveX component can't create object: 'MAPI.Session' " which points to line 16; set objSession = CreateObject("MAPI.Session")

Am I missing something?  I even tried to install the MAPI version of CDO on a machine without Outlook and still get the above message. I even registered CDO.DLL with regsvr32 with no luck.

Thanks in advance.

0
Login to vote
pscott99's picture

Is there any chance we could get this written for exchange 2010 server 2008R2 ? It would be really helpfull to know why enterprise vault is not vaulting so many items in a mailbox and what they are ?

0
Login to vote
Rob.Wilcox's picture

I get the same issue with the Outlook 2007 CDO package installed.  But I don't know why that is.  I don't really have that much time to investigate it right now.

I would suggest using the Redemption version:

https://www-secure.symantec.com/connect/downloads/scanning-mailbox-redemption-version

Or use the QUADROtech Mailbox Analysis tool:

http://www.quadrotech-it.com/products/evtools/mailbox-analysis/

The first link does work on Windows 2008 R2 with Outlook 2007 installed, I just tried it :)

+1
Login to vote