Click here to Skip to main content
15,846,727 members
Articles / Productivity Apps and Services / Microsoft Office

How to List your Outlook PST Details (file name/location, PST (old/new) version, size, etc.)

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
26 Oct 2011CPOL2 min read 63.4K   3.9K   17   10
A fast way to display the details of all PSTs currently loaded into Outlook


Did you ever need to get a full list of PSTs a user has loaded into Outlook?

Did you let a user backup their own PSTs, only to find they didn't copy the files in the {hidden} AppData directory?

What, the PST file names don't match the Outlook PST folder names?

Which file do I need to add back in to get my #### folder?

How about users still using the old Outlook PST format and have no clue they are 1 message away from a corrupted PST {yuk}?

This small application answers all those questions (What's my user name, my Outlook profile name, the path and PST file names, PST version (old/new), what is displayed as in Outlook, PST size, and when the PST file was created), and you can copy the results to your clipboard.



I needed a tool like this when we started replacing user's computers and needed to document what PSTs each user was using. Simple enough, just research where the data is (registry) and how to get it out in a readable format.

Using the Code

Start by reading the registry:

' Get user name and default Outlook profile name
Dim ProfilesRoot As String = _
"Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
Dim DefaultProfileString As String = "DefaultProfile"
Dim reg As RegistryKey = Nothing
  reg = Registry.CurrentUser.OpenSubKey(ProfilesRoot)
  Dim DefaultProfile_Name = reg.GetValue(DefaultProfileString, 0).ToString
  RichTextBox1.Text = " User Name:  " & GetUserName() & vbCrLf
  RichTextBox1.Text = RichTextBox1.Text & _
	" Default Outlook Profile Name:  " & DefaultProfile_Name & vbCrLf & vbCrLf
Catch ex As Exception
  ' Outlook Profile registry keys do not exist
  Me.Visible = True
  MessageBox.Show("This user does not have an Outlook profile", _
		"", MessageBoxButtons.OK, MessageBoxIcon.Stop)
End Try

Get the user's name:

Function GetUserName() As String
  If TypeOf My.User.CurrentPrincipal Is  _
    Security.Principal.WindowsPrincipal Then
    ' The application is using Windows authentication.
    ' The name format is DOMAIN\USERNAME.
    Dim parts() As String = Split(My.User.Name, "\")
    Dim username As String = parts(1)
    Return username
    ' The application is using custom authentication.
    Return My.User.Name
  End If
End Function

Obtain the PST details (see the full source code).

Add color to text in the RichTextBox (after the data is entered):

Dim Find As Integer
Dim BeginHere As Integer = 0
Dim SLength As Integer
BeginHere = 0
Dim SearchText1 As String = "User Name:"
SLength = SearchText1.Length
  Find = RichTextBox1.Find(SearchText1, BeginHere, RichTextBoxFinds.MatchCase)
  If Find > -1 Then RichTextBox1.SelectionColor = Color.Blue
  BeginHere = BeginHere + SLength
  If BeginHere > Len(RichTextBox1.Text) Then Exit Do
Loop While Find > -1
RichTextBox1.Select(Len(RichTextBox1.Text) + 1, 0)
RichTextBox1.SelectionColor = Color.Black

Copy the RichTextBox text to clipboard (I flash the button color to show the data was copied):

Clipboard.SetText(RichTextBox1.Text, TextDataFormat.Text)
Button1.BackColor = Color.LightSalmon
' wait .5 second 
Button1.BackColor = Color.Snow

Points of Interest

You can lead a user to Outlook, but you can't make them keep their PSTs all in one directory.

I just had to develop this utility as many hours were expended repairing Outlook PSTs and this allows users to document what they are using.

Here are the check sums of the pst_info.exe compiled application (VERIFY FILE INTEGRITY PRIOR TO EXECUTING, or recompile to be on the safe side).

		MD5				SHA-1
-------------------------------- ----------------------------------------
87afb53027064cf3b9f58b47d64bd4a2 fe13b256f1b94bd5fba3bcc6ca49630a2c6732f6


  • Version 1.0 - Published 25 Oct 2011


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

QuestionOutlook 2016? Pin
Member 1287987930-Nov-16 13:49
Member 1287987930-Nov-16 13:49 
QuestionIs there a C# version of this Code? And is there a way to list *.ost files too? Pin
Gökmen BULUT17-Aug-15 21:52
Gökmen BULUT17-Aug-15 21:52 
Questionrunning under Outlook 2010 Pin
Member 1090182623-Jun-14 15:59
Member 1090182623-Jun-14 15:59 
QuestionHow to find all PST files under c:\ Pin
atifbaig16-Apr-14 11:59
atifbaig16-Apr-14 11:59 
QuestionWin7 Office 2010 Pin
Jacob Taunton28-Feb-13 21:26
Jacob Taunton28-Feb-13 21:26 
AnswerRe: Win7 Office 2010 Pin
mllarson28-May-13 8:41
mllarson28-May-13 8:41 
QuestionPST .NET Pin
Fransoa Gole6-Dec-12 22:42
Fransoa Gole6-Dec-12 22:42 
QuestionExcellent Pin
Member 93448248-Aug-12 14:39
Member 93448248-Aug-12 14:39 
GeneralMissing Files Pin
ledtech320-May-12 9:37
ledtech320-May-12 9:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.