Posts Tagged ‘performance’

Automating Outlook’s Inbox Repair Tool (ScanPST)

Date September 2, 2008

File-Schedule I find that Outlook’s Personal Folder (.pst) files have a haphazard way of getting corrupted - which obviously impacts daily performance as well as reliability of my email achieve.  Microsoft’s Inbox Repair Tool (ScanPST) diagnoses and repairs corrupt .pst/.ost files to make sure the file structure is intact, but the process requires more manual intervention than I care for. So, here’s how I made Outlook’s Inbox Repair process completely automated:

Step 1: Download some 3rd party utilities!

  1. Download NirCmd.zip.
    In order to run the ScanPST utility against your .pst/.ost files, Outlook must be shutdown.  While there isn’t a way to do what we need natively in Windows, NirCmd (free) allows us to accomplish the task gracefully - meaning Outlook will not shut down when unsaved content exists (in which case the Repair will be skipped for this instance).
    (Note: If you prefer to forcefully end Outlook, you can do so using process.exe [1] . Of course, doing this could cause corruption - which is what we’re trying to avoid/fix!)
  2. Extract nircmdc.exe[2] to ‘C:\Windows\System32′.
    (Note: I don’t usually like to install 3rd party executables to Windows\System32\. In this case, however, I feel these simple cli utilities don’t justify additions to my Path entry. If you wish to install somewhere else, you can add the location to your Path[3] or add the full path into the script file.)
  3. Download cmdscan.zip.
    Quester’s cmdscan (free) allows us to run ScanPST without any user interaction.
  4. Extract cmdscan.exe to ‘C:\Windows\System32′
  5. Download autopst.bat – my batch file template.

The next Steps will outline what is happening in the batch file:

Step 2: Make sure Outlook is not running/Close Outlook if it is.

  1. (informational) To gracefully close outlook, the script executes:
    nircmdc closeprocess outlook.exe.

    To test your nircmd install,
    open Outlook and execute this command from the command prompt.
  2. (informational) We want to give Outlook ample time to close because the Repair Tool will not analyze/fix an open .pst file.  To do this, we pause 15 seconds by executing:
    nircmdc wait 15000.
    Note: adjust the wait time as you see fit. (e.g.,1sec = 1000; 15sec = 15000)

Step 3: Run ScanPST from the Command Line.

  1. Find the path to scanpst.exe on your computer:
    1. in Outlook 2003 – ‘C:\Program Files\Common Files\System\Mapi\1033\’
    2. in Outlook 2007 – ‘C:\Program Files\Microsoft Office\Office12\’
  2. Edit autopst.bat in notepad and verify ScanPST-location=”<your path>
  3. If your .pst/.ost files are in the default location, the command in the script - cmdscan %ScanPST-location% *.pst *.ost - will work just fine.  (Otherwise, follow the instructions in readme.txt, found in the cmdscan.zip file.  It will show all your file selection options).

Step 4: (optional) Open Outlook so it’s ready to go when you access your computer again.

  1. If you prefer not to automatically restart Outlook after the scan, add ‘REM’ in front of the ‘start outlook.exe’ line.

Step 5: Create a Scheduled Task [4]

  1. Start –> Programs –> Accessories –> System Tools –> Scheduled Tasks.
  2. Next –> Browse… –> select the autopst.bat file –> Next
  3. Select task frequency (i.e., Daily/Weekly) –> Next
  4. Set run time (when are you least likely to need Outlook open?
  5. … you get the idea …

Step 6: Test

  1. Double-click on the autopst.bat file or execute the newly created task to make sure things go as expected.
Footnotes/References:
  1. Command Line Process Viewer/Killer/Suspender - This method first tried to gracefully shut down Outlook.  If Outlook remains open after 60 seconds, the process is forced to terminate.[]
  2. nircmdc is a command line only version of nircmd - this makes popup dialogs print to cmd window instead; thus, allowing us to automate processes more reliably[]
  3. How to set the path in: Windows XP / Vista[]
  4. How To Schedule Tasks in Windows XP[]

Tweak: Auto-login on Startup & Lock PC Immediately

Date May 11, 2008

This tweak initiates the User’s logon/startup sequence before locking Vista/XP; thus, speeding up the OS startup process while maintaining the security provided by the login screen.

What it solves: Traditionally, you turn on your computer and wait a few minutes. Then, you log into windows and wait a few more minutes. This tweak eliminates that wasted time by allowing you to turn on your computer, go work on something else for a few minutes, come back, login and begin working immediately because your profile and startup programs have already loaded! It is particularly useful for people who are the sole or primary user of their PC and use the login screen purely as a security mechanism.

I couldn’t find a streamlined step-by-step guide online so I figured I’d put one together myself.  Sources are credited below.

Step 1: Auto-Login on Startup.[1]

  1. In Vista, Click Start, type netplwiz in the search field, and hit Enter.
    In XP, Click Start, click Run, type control userpasswords2
    (This loads the Advanced User Accounts control panel).
  2. Uncheck the Users must enter a user name and password to use this computer option.
  3. Click Apply.
  4. Enter your password into the Automatically Log On dialog box that pops up and click “OK“.

Step 2: Lock PC Immediately after Login.[2]

  1. Click Start -> All Programs, right-click on the Startup folder, and select Open.
  2. The Explorer Window opens. Right-click in the whitespace and point to New and click Shortcut.
  3. The Create Shortcut Wizard opens. In the text box, type the following:
    rundll32.exe user32.dll,LockWorkStation
  4. Click Next.
  5. Enter a name for the shortcut (e.g., “Lock Workstation“).
  6. Click Finish.

Step 3: Reboot.

Footnotes/References:
  1. about.com - Source of Auto-Login steps.[]
  2. microsoft.com - Source for Lock PC steps.[]