Tool Obtains the Total Size of Users' .pst Files


I've been working as a consultant for a large company that recently invested in a SAN environment dedicated to Exchange Server. Previously, the company used a midsized SCSI disk bay and stored data in .pst files on the client machines. The company wanted to reorganize its Exchange storage architecture so that mail data could be backed up as soon as possible and not stored on workstations in .pst files.

To plan for the migration of the .pst files to Exchange storage groups (SGs), it was necessary to know precisely how much mail data was currently stored on the workstations. Because the .pst files were managed on the client machines, there was no easy way to find out the global size of all mail data to prepare for such a migration. I therefore decided to create a tool named GetPSTSize to get this information.

GetPSTSize is command-line tool that computes the total size of the .pst files associated with the default Messaging API (MAPI) profile of the currently logged-on user. GetPSTSize records in a log file the total size (in bytes) of the .pst files on that user's machine. The log file is named username.txt, where username is the name of the user. GetPSTSize creates this file in the current directory, unless you specify an alternative directory when you run the command. Besides writing the .pst files' total size to the log file, GetPSTSize displays the total size in the command-shell window, as Figure 1 shows.

You can easily call GetPSTSize from logon scripts by specifying a common shared directory in which users have the permissions necessary to create the log files. That way, you'll have a central location that contains statistics about your users' .pst files. You can then use a script to iterate through all the log files in the shared directory, retrieve each user's name and the total .pst size for that user's mailbox, and write this information to a comma-separated value (CSV) file. When you open the CSV file in a spreadsheet program such as Microsoft Excel, you can get an overview of the size of your clients' mail data. Summarize.vbs in Listing 1 is an example of the type of script that you can use. The only argument Summarize.vbs takes is the pathname to the location where the log files have been saved. As Figure 2 shows, the script sends the CSV-formatted data to standard output, which you can easily redirect to a file.

You can adapt Summarize.vbs so that it groups users by their department, organizational unit (OU), or any other type of information contained within Active Directory (AD). To do so, you need to take advantage of Active Directory Service Interfaces (ADSI) and ActiveX Data Objects (ADO). For example, you can group the users by department by appending the GetUserComplementaryInfo and GetService functions that Listing 2, shows to the end of Summarize .vbs. You then need to append the code

& GetUserComplementaryInfo(sUser) 

to the end of the line highlighted by callout A in Listing 1.

With GetPSTSize, you can get a better idea of how much data your users store on their client computers. If you're just beginning to reorganize your Exchange storage architecture, this information can be a good starting point for planning the migration of .pst files to Exchange SGs. The information can also be useful in determining whether you need to set mailbox quotas. If you've already reorganized your Exchange storage architecture, this information can provide an opportunity to review your storage setup and mailbox quotas.

You can download GetPSTSize, Summarize.vbs, and the code in Listing 2 from the Exchange & Outlook Administrator Web site. You can also download GetPSTSize (but not Summarize.vbs or the code in Listing 2) from ( |superb-west).

—Arnaud Auber
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.