Tip

Defragment Microsoft Outlook .PST files for better performance

As much as companies try not to use .PST files with Microsoft Outlook, sometimes they're simply unavoidable. If you have .PST files, I recommend using Sysinternal's Contig utility for general system optimization

    Requires Free Membership to View

and to keep Microsoft Outlook .PST files running faster.

VIEW MEMBER FEEDACK TO THIS EXCHANGE TIP
Mark Russinovich, the genius behind Sysinternals (now a Microsoft entity), created the Contig tool as a way to allow people to quickly defragment single files with as little overhead as possible. It's a command-line tool that uses the Windows defragmentation APIs; it takes a fragmented file and moves all of its clusters together into a single contiguous file.

Since the program doesn't use any undocumented variations on the APIs, it's perfectly safe. You can't lose data when using the program even if you pull the plug on the computer or suffer a crash.

Microsoft Outlook .PST files can grow quite large, so Microsoft Outlook performance can suffer if they're fragmented. As an example, my current 277 MB .PST file was defragged before I signed on this morning. After only half a day's use, it was already in 10 fragments.

The Contig tool can be used to defragment just the .PST file, so you don't have to defragment your whole system just to speed up the performance of that one .PST file. The way I've typically done this is with a batch file that runs Contig against all the files in my mail directory:

contig "%userprofile%\My Documents\My Email"

Note: The exact location of the mail directory will vary.

Because Contig works with the Windows defrag APIs, you can run it while Microsoft Outlook is also running and not suffer any ill effects.

The time it takes to defragment the Microsoft Outlook .PST file will vary depending on the speed of your system and the hard drive. During that time, the .PST file might be intermittently unavailable, or at least perform a little more slowly than normal. On my system, the 277 MB .PST file was defragmented in a matter of seconds.

More on .PST files and Exchange defragmentation:
A primer on Exchange .PST files

Repair damaged .PST files with OutlookFIX

Migrating older .PST files to Microsoft Outlook 2003

Recover lost .PST passwords

Exchange Server defragmentation tips and resources

Microsoft Outlook and Exchange Server administration tools

About the author: Serdar Yegulalp is editor of Windows Insight, a newsletter devoted to hints, tips, tricks, news and goodies for all flavors of Windows users.

MEMBER FEEDBACK TO THIS TIP

Can I add switches to the contig bat file, such as –v, to see the results?

For example: contig –v %profile%/etc
—David B.

******************************************

You can indeed do that, but if you're not around to see the process running you probably won't be able to tell what happened (since the console output won't be logged anywhere).

You can accomplish this by redirecting the output to a log file:

contig -v %profile%/etc > c:\logfiles\contig_log.txt

This is a very simple example, but with this you can see the results of the most recent Contig run no matter when it happened.
—Serdar Yegulalp, tip author

******************************************

If the user does not have Admin privileges, I get "Access Denied" when I try and run this against their .PST file. As soon as I make the user an Admin it works fine. I'm unclear as to why Admin privileges would be required considering the user has full privileges to the directory location within their profile. Any ideas?
—Brian A.

******************************************

The user might have full control over the files, but he might not have been granted the ability to perform the kind of file-system manipulation that the tool in question requires. It's basically the same restriction that prevents a user from running the DEFRAG command-line tool.

One way you can get around this is by creating a scheduled task which runs with Admin permissions; the Admin password is provided by an administrator and stored in an encrypted form, so the user doesn't need to know the password.

(This is also a way to run defrag without admin permissions -- just create a scheduled task for it that runs as admin during an off peak period when the PC is known to be on, so the user doesn't actually need to do anything.)
—Serdar Yegulalp, tip author

******************************************

Does the Contig utility work with Windows XP Tablet PC Edition (and Microsoft Outlook 2000)?
—K.P.

******************************************

Yes, I believe Contig works on all NT-based 32-bit versions of Windows, including XP Tablet Edition.
—Serdar Yegulalp, tip author

Do you have comments on this tip? Let us know.

Please let others know how useful this tip was via the rating scale below. Do you have a useful Exchange Server or Microsoft Outlook tip, timesaver or workaround to share? Submit it to SearchExchange.com. If we publish it, we'll send you a nifty thank-you gift.


This was first published in February 2007

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.