You no longer need this tool! Microsoft recently updated thier SCANPST utility to include all the functionality of CSCANPST!
Read about it here:
I tried it out and it works great!...
(Note that the "-rescan" didn't work, but the "-force" ones did.)
And a big thanks to Harry Q. for the heads-up on this change!
SCANPST is a utility published by Microsoft for repairing Outlook PST files. Unfortunately, the SCANPST utility does not have any command-line interface so you can only control it interactively from the GUI. Since SCANPST can take a long time to run and because it requires user input while running, this can be a big waste of time.
CSCANPST is tool that will let you use SCANPST from the command-line, making it possible to write batch files that will run SCANPST unattended.
CSCANPST is now open source! I just don't have time to maintain it anymore, and there are lots of people offering to do translations into other languages. The code is here... https://github.com/bigjosh/CSCANPST Please contribute back any updates, fixes, improvements, or translations! Thanks! -josh |
UPDATE: Jason Simotas has written a graphical front end to CSCANPST. You can find it here. http://www.rethinkit.com/blog/tech-tip-outlook-how-to-bulk-fix-pst-files-scanpstall/ It automaticall finds your active PST files and even supports Drap-and-Drop of your other PST files. Unless you specially want a command line tool for writing your own scripts, this is probably what you want. |
To save time. Even if you only have a single PST file, every time you run SCANPST you have to sit and watch it run so you can respond to the pop-up dialog boxes that it generates. By contrast, with CSCANPST, you can start the process and then go get a cup off coffee; it will run until it is done without needing any additional input from you.
If you have multiple PST files, you can even use a batch file to automatically run SCANPST on all of them with just one step. Again, you can start the process and then let it run until it is done while you do something else. This is much better than having to manually launch SCANPST on each PST file individually and watch it run.
The CSCANPST.EXE executable takes two requered parameters. The first is the fully qualified path to a SCANPST.EXE executable. The second is the name of the PST file to scan.
You can optionally add an "N" at the end of the command line to suppres the creation of a backup PST file.
Once launched, CSCANPST will load SCANPST and send it the requested filename. It will respond to SCANPST input requests until either the file is repaired or there is an error.
On exit, CSCANPST will set the DOS errorcode to one of the following values...
ErrorLevel | Meaning |
0 | Scan completed successfully. No errors found. |
1 | Scan completed successfully. Minor inconcistancies found and repaired. |
2 | Scan completed successfully. Errors found and repaired. |
3 | Another copy of SCANPST is already running. Quit out any running instances and try again. |
4 | User canceled the scan. |
5 | Error opening the specified PST file. |
6 | File already in use. Make sure Outlook is not running. |
7 | Could not find the specified PST file. Check that you specified the correct directory and filename. |
8 | File type not recognized. Make sure the specified file is an Outlook PST file. |
9 | An error has occurred in SCANPST which caused the repair to be stopped. Some modifications may have been made to the scanned file. |
10 | PST file was read only - file not scanned. |
11 | Not enough arguments on command line (must be at least two). |
12 | Specified SCANPST.EXE not found. |
13 | Specified PST file not found. |
CSCANPST will always answer "yes" when SCANPST asks to make a backup file. It
will always use the default file name for the backup file (typically the PST
name with a .BAK extention).
CSCANPST will append a line to the file called "CSCANPST.LOG" with details of the scan. If the log file does not exist, it will be created. The appended line will show the file scanned and outcome. Possible outcomes are...
ERROR: User canceled |
ERROR: Could not open file |
ERROR: File already in use |
ERROR: File not found |
ERROR: File type not recognized |
No errors found |
Minor inconsistencies repaired |
File repaired |
Entering this command will scan the specified PST file and return to the command prompt...
CSCANPST "C:\Program Files\Common Files\System\Mapi\1033\scanpst.exe" "C:\Documents and Settings\User Profile\Local Settings\Application Data\Microsoft\Outlook\Archive.pst"
Here is a short batch file that will scan the two specified PST files and then report the results...
del CSCANPST.LOG CSCANPST "C:\Program Files\Microsoft Office\Office12\SCANPST.EXE" "C:\Outlook\main.pst" CSCANPST "C:\Program Files\Microsoft Office\Office12\SCANPST.EXE" "C:\Outlook\work.pst" CSCANPST "C:\Program Files\Microsoft Office\Office12\SCANPST.EXE" "C:\Outlook\Spam.pst" type CSCANPST.LOG
Here is an example of the output in CSCANPST.LOG after running it on my computer (I have a lot of PST files)...
Launched on C:\Users\josh\Documents\Mail\archive.pst...File repaired Launched on C:\Users\josh\Documents\Mail\mail2005.pst...No errors found Launched on C:\Users\josh\Documents\Mail\Mail2006.pst...No errors found Launched on C:\Users\josh\Documents\Mail\Mail2007-B.pst...No errors found Launched on C:\Users\josh\Documents\Mail\Mail2007.pst...No errors found Launched on C:\Users\josh\Documents\Mail\Mail2008-A.pst...No errors found Launched on C:\Users\josh\Documents\Mail\Spam-062808.pst...File repaired Launched on C:\Users\josh\Documents\Mail\Spam-0805.pst...No errors found Launched on C:\Users\josh\Documents\Mail\Spam.pst...No errors found Launched on C:\Users\josh\Documents\Mail\spam20080908.pst...No errors found
Q: How can I find the location of my SCANPST.EXE?
A: You can do a Windows file search for "SCANPST.EXE".
Alternately, check out this
helpful page.
Q: How can I find the location of my PST files?
A: You can do a Windows file search for "*.PST". Alternately,
check out
this helpful page.
Q: How does CSCANPST work?
A: CSCANPST is written in the surprisingly handy
AutoHotKey language. It basically runs
the SCANPST.EXE then watches for certain strings of words in windows that
SCANPST generates. Based on what it sees, it pushes the right buttons to make
SCANPST complete its job.
Q: SCANPST poped up a message that CSCANPST does not seem to be
responding to.
A: CSCANPST responds to every error I could make happen, but there may be others
that only happen in situations that I could not create. If you ever see one of
these, please email me and let me know and I will add that case to CSCANPST. A
screenshot showing the exact wording on the pop-up message would be very
helpful.
Q: I am using a non-English version of Office and CSCANPST
doesn't seem to work.
A: Yes, CSCANPST actually looks at the text inside the SCANPST
windows to know what to do and when to type, so it will not recognize what is
going on in windows that have non-English text. Probably the easiest solution is
to find a English version of the SCANPST.EXE executable and run CSCANPST using
that. Note that you do not need to install Office in English or even overwrite
your existing SCANPST, just get an additional copy of SCANPST.EXE and
OLMAPI32.DLL in English, put them in any directory on your hard drive, and
specify the path to this new SCANPST.EXE when running CSCANPST.
Some translations also and insturctions here...
https://github.com/bigjosh/CSCANPST/tree/master/source/translations
Q: How much does CSCANPST cost?
A: CSCANPST is free. I do ask that you do not redistribute it- instead, please
send people to this webpage so they can download it themselves. It would also be
great if you could send an email to me at the support address below so that I can let you know about any updates to the
program.
Q: Isn't there an easier/better way to do this?
A: Not that I could find. It does seem like Microsoft could have very easily
added a few command-line parameters to SCANPST, but they didn't. Of course the
day after I finished CSANPST I found
this page. It is very similar to CSANPST, but I think (now that I already
made it) that mine is a bit better documented.
If you really love CSCANPST, you can express your gratitude though a tax-deductible donation of any size to my favorite charity, The Aasha Foundation. They spend zero on administration and fundraising, so every dollar you give goes directly to helping the orphans.
Q: What is your relationship to Microsoft, makers of SCANPST?
A: None, except that I am a user of their program.
Q: Sometimes it seems like SCANPST gets "stuck", but then wakes
up if I click anywhere in the window.
A: This happens sometimes to me too. It might be a bug in
AUTOHOTKEY or Windows. I've found that it usually only happens if I am going
something else while the scan is running that messes up the window focus, so I
usually start CSCANPST running and then leave the computer alone. Great excuse
to go get a cup of tea.
Q: Does CSCANPST work with non-English versions of SCANPST.EXE?
A: Unfortunately CSCANPST looks specifically for English text in
the window titles and prompts, so it will not work with non-English versions of
Scanpst.exe.
You can download an English version of ScanPst.exe and use CSCANPST with that instead. See FAQ question above.
Q: How can I automatically keep scanning a PST file until it is
completely repaired?
A: Often it takes a few passes of SCANPST to completely fix a
broken PST file.
It is easy to do this automatically in a batch file that checks the return code from CSCANPST. For example:
REM ***This batch file will automatically run SCANPST on specified PST file in the REM ***directory specified by PST_FILE_MASK. REM ***It will keep running until the file is clean or there is an error. set SCANPST_PATH="C:\Program Files (x86)\Microsoft Office\Office14\SCANPST.EXE" set PST_FILE="D:\Users\josh\Documents\My Mail\Mail2010.pst" REM *** CD into in the directory that contains the launched batch file... echo CDing into %~dp0 %~d0 cd %~p0 del cscanpst.log :loop cscanpst.exe %SCANPST_PATH% %PST_FILE% if errorlevel 3 goto DONE if errorlevel 1 goto loop ECHO *****File scanned clean! :done @echo Log: @type cscanpst.log @pause |
This will keep scanning and scanning until either the file comes back with no errors, or CSCANPST hit a non-recoverable error (like file not found).
Just be sure to paste in the correct values for SCANPST_PATH and PST_FILE for your machine.
Q: How can I have it scan though all PST files in a tree of
subfolders?
A:
It is possible to do in with a little batch file magic. Check out this lin for
ideas…
https://ss64.com/nt/for_r.html
5/19/2018 | New release on GitHub. Fixes some glaring errors in the example batch file, adds pre-compiled .exe's for the translations. | |
11/25/2013 | - | Source code released on GitHub! |
7/28/2012 | - | Added link to new GUI tool. |
10/13/2011 | - | Added Q&A about how to keep scanning a file until it comes clean. |
5/25/2010 | - | New version of the CSCANPST executable that _really_ fixes "suppress backups " to for both "error repair" and "minor inconsistancies" repairs. Wow, that was harder than I thought! |
4/29/2010 | - | New version of the CSCANPST executable that fixes "suppress backups " to for both "error repair" and "minor inconsistancies" repairs. |
4/26/2010 | - |
Note that this new version changed the errorlevel values so you must update any bacth files that check these values. Now any error level less than 3 indicates success.
|
2/5/2010 | - |
|
10/3/2009 | - |
|
11/3/2008 | - |
|
11/24/2008 | - |
|
1/12/2008 | - |
|
3/5/2009 | - |
|
4/22/2009 | - |
|
7/8/2009 | - |
|
For support, please email me at...