CSCANPST To Automate Running SCANPST.EXE

Status
Not open for further replies.

srmsrm

Senior Member
Outlook version
Outlook 365 64 bit
Email Account
IMAP
I'm looking for help on a program call CSCANPST.EXE (http://josh.com/cscanpst) that I use to automate using SCANPST.EXE. I was hoping maybe others had used it and can provide some feedback. I also tried cmdscan.exe (http://www.opindian.com/blog/2008/09/02/automating-outlooks-inbox-repair-tool-scanpst/) but it does not seem to work on larger PST files (mine is about 10.5 GB).



I am using W7 64 Bit with the scheduler. I have so the task runs when I’m logged in (which is usually always – even at night). The script runs, however, it seem the path (field) to the PST file is not populated until I click on the SCANPST dialog. If I run the batch file directly, it seems to work fine.
Below is my script that I have configured to run CSCANPST.EXE multiple times if there is error 1 or 2. Errors 1 or 2 reflect file needs repaired and he script reruns.
Any suggestions? I know its not specifically an Outlook issue, however, thought I would try.
=============================================
REM Stop the Win Mobile sync application

nircmdc killprocess wcescomm.exe
REM Gracefully close Outlook so that the repair scan can run

nircmdc closeprocess outlook.exe
REM Wait for outlook to close and clean up
nircmdc waitprocess outlook.exe
REM Delete scan log
Del cscanpst.log
REM Scan PST file and add an N to the end to remove backup files
REM Based on error, either finishes or rescans.
cscanpst.exe "C:\Program Files (x86)\Microsoft Office\Office14\SCANPST.EXE" "C:\SRMDATAPST\Work.PST" N
if %errorlevel% == 0 GOTO FINISH
if %errorlevel% == 1 GOTO RESCAN1
if %errorlevel% == 2 GOTO RESCAN1
if %errorlevel% == 3 GOTO FINISH
if %errorlevel% == 4 GOTO FINISH
if %errorlevel% == 5 GOTO FINISH
if %errorlevel% == 6 GOTO FINISH
if %errorlevel% == 7 GOTO FINISH
if %errorlevel% == 8 GOTO FINISH
if %errorlevel% == 9 GOTO FINISH
if %errorlevel% == 10 GOTO FINISH
if %errorlevel% == 11 GOTO FINISH
if %errorlevel% == 12 GOTO FINISH
if %errorlevel% == 13 GOTO FINISH
:RESCAN1
REM Scan PST file and add an N to the end to remove backup files
REM Based on error, either finishes or rescans.
cscanpst.exe "C:\Program Files (x86)\Microsoft Office\Office14\SCANPST.EXE" "C:\SRMDATAPST\Work.PST" N
if %errorlevel% == 0 GOTO FINISH
if %errorlevel% == 1 GOTO RESCAN1
if %errorlevel% == 2 GOTO RESCAN1
if %errorlevel% == 3 GOTO FINISH
if %errorlevel% == 4 GOTO FINISH
if %errorlevel% == 5 GOTO FINISH
if %errorlevel% == 6 GOTO FINISH
if %errorlevel% == 7 GOTO FINISH
if %errorlevel% == 8 GOTO FINISH
if %errorlevel% == 9 GOTO FINISH
if %errorlevel% == 10 GOTO FINISH
if %errorlevel% == 11 GOTO FINISH
if %errorlevel% == 12 GOTO FINISH
if %errorlevel% == 13 GOTO FINISH
:FINISH



=============================================

Thanks.

Shawn

 
Thanks to those who reviewed my thread. I think I got it resolved so I can automate running SCANPST.EXE. I used more of the vendor's code.

set SCANPST_PATH="C:\Program Files (x86)\Microsoft Office\Office14\SCANPST.EXE"

set PST_FILE_MASK="C:\SRMDATAPST\*.pst"

nircmdc killprocess wcescomm.exe

nircmdc closeprocess outlook.exe

nircmdc waitprocess outlook.exe

Del cscanpst.log

for %%i in (%PST_FILE_MASK%) do (cscanpst.exe %SCANPST_PATH% "%%i" N)

if %errorlevel% == 0 GOTO FINISH

if %errorlevel% == 1 GOTO RESCAN1

if %errorlevel% == 2 GOTO RESCAN1

if %errorlevel% == 3 GOTO FINISH

if %errorlevel% == 4 GOTO FINISH

if %errorlevel% == 5 GOTO FINISH

if %errorlevel% == 6 GOTO FINISH

if %errorlevel% == 7 GOTO FINISH

if %errorlevel% == 8 GOTO FINISH

if %errorlevel% == 9 GOTO FINISH

if %errorlevel% == 10 GOTO FINISH

if %errorlevel% == 11 GOTO FINISH

if %errorlevel% == 12 GOTO FINISH

if %errorlevel% == 13 GOTO FINISH

:RESCAN1

for %%i in (%PST_FILE_MASK%) do (cscanpst.exe %SCANPST_PATH% "%%i" N)

if %errorlevel% == 0 GOTO FINISH

if %errorlevel% == 1 GOTO RESCAN1

if %errorlevel% == 2 GOTO RESCAN1

if %errorlevel% == 3 GOTO FINISH

if %errorlevel% == 4 GOTO FINISH

if %errorlevel% == 5 GOTO FINISH

if %errorlevel% == 6 GOTO FINISH

if %errorlevel% == 7 GOTO FINISH

if %errorlevel% == 8 GOTO FINISH

if %errorlevel% == 9 GOTO FINISH

if %errorlevel% == 10 GOTO FINISH

if %errorlevel% == 11 GOTO FINISH

if %errorlevel% == 12 GOTO FINISH

if %errorlevel% == 13 GOTO FINISH

:FINISH
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Outlook macro to automate search and forward process Outlook VBA and Custom Forms 6
S automate save the .xlxs file to share Network Using Outlook 1
P Automate Outlook Start - No Active Explorer Object Found Using Outlook 10
C Further automate several tasks with rule, VBA or Quick Step Using Outlook 1
K Automate permamnent delete after x days with exceptions Using Outlook 1
O automate dates in outlook template Using Outlook 1
T Automate Outlook 2010 Using Outlook 4
S How to automate showing the Public Folder Calender to Mail Favorite folder Using Outlook 0
J OL2003 Macro disables itself - looking for way to automate 'enable' Using Outlook 2
S Automate saving of attachments on new incoming emails Outlook VBA and Custom Forms 3
B automate email message on Outlook Calendar notification alerts? Outlook VBA and Custom Forms 1
S automate outlook stationary Outlook VBA and Custom Forms 1
Q Automate Outlook profiles for imaging Using Outlook 2
Q Automate BCM backup? BCM (Business Contact Manager) 1
F Running Scripts in Outlook 2021 Using Outlook 0
L Modifying VBA script to delay running macro Outlook VBA and Custom Forms 3
A VBscript stops running after updating form Outlook VBA and Custom Forms 1
N contact notepad 'style' getting changed after clicking and running Activities Using Outlook 2
Bri the Tech Guy Run Script rule not running for newly arriving messages Outlook VBA and Custom Forms 25
S Problem running Command button code Outlook VBA and Custom Forms 2
B Automation error running VB macro code Outlook VBA and Custom Forms 8
Diane Poremsky OUTLOOK.EXE continues running after you exit Outlook Using Outlook 0
Diane Poremsky Running Outlook Macros on a Schedule Using Outlook 0
B ActiveExplorer return NULL on new Window user login and running Outlook first time Using Outlook 1
JorgeDario Template oft that contains VBScript Is not running Using Outlook 1
M Mark Complete keyboard shortcut... on a mac running Windows Bootcamp Using Outlook 0
N Outlook 2007 To-Do-List status keeps running Using Outlook 2
S The attempted operation failed ... 2nd time running code Outlook VBA and Custom Forms 3
G email returns after running macro to move emails Outlook VBA and Custom Forms 1
P Outlook Macro keeps running for the same messagage Using Outlook 2
N Running multiple macros upon sending Outlook VBA and Custom Forms 6
M Accessing BCM with Excel / Running Reports BCM (Business Contact Manager) 1
G Error when running scanpst.exe Using Outlook 1
V Running scripts with Outlook 2013 Using Outlook 17
D Stopping "do you want to continue running scripts on this page" warnings Using Outlook 4
M Running macros in tasks sent out as meeting requests in invitees machine Using Outlook 4
N Rules stop running automatically Using Outlook 10
D VBA code running on Server? Shared mailbox email routing Using Outlook 3
T WAB editing: To help prevent malicious code from running.......... Using Outlook 18
M Outlook.exe 1.2Gb memory usage if running certain BCM reports BCM (Business Contact Manager) 8
M Why rules stop running automatically? Using Outlook 1
V Trouble Running Outlook 2007 and 2010 Using Outlook 4
L remove a hotmail account from Outlook 2007 running on Vista home premium Using Outlook.com accounts in Outlook 1
S Outlook 2007 Running on Windows 7 hangs on send Using Outlook 7
A running code after the new inspector is visible Outlook VBA and Custom Forms 1
M Running Outlook as Scheduled task Outlook VBA and Custom Forms 1
S ActiveExplorer return NULL on new Window user login and running Outlook first time Outlook VBA and Custom Forms 19
E Word macro running from OL VBA throwing error on Word SaveAs?? Outlook VBA and Custom Forms 8
A Running Code in Side by side calendar view Outlook VBA and Custom Forms 2
G Re:Running a Macro when email arrives Outlook VBA and Custom Forms 1

Similar threads

Back
Top