Jump to content
Sign in to follow this  
ZacUSNYR

PST File Location

Recommended Posts

BrewManNH,

Thanks for the suggestion. I actually already have it coded into my script to back up the default locations for PST files, as well as other folders in their profile. Typically the data is there. The problem lies in that some people at the university I work at don't know how to properly create archives, so they end up making about 10 of them when only 1-2 are needed. I just wanted a list of the ones that are loaded up with their default profile to make it easier for our students to determine which ones to add back into Outlook when the new profile is created. It looks like it's going to be a lot more trouble than it's worth.

That said, the PST list is not as big of a deal as the shared mailboxes that are added to their account or the account list. Our student workers always forget to grab that. Again, though, probably more trouble than it's worth. Thanks for the suggestions guys!

Share this post


Link to post
Share on other sites

Sad day.

I created a new PST file called "Test.pst" and I can't find any mention of it in the default profile's registry keys. I see plenty referencing my "Archive.pst," but can't seem to find anything regarding a second mounted PST file.

Here's the code I've been testing with just to see if I can get anything...

#include <String.au3>
#include <Array.au3>

$sDefaultProfile = RegRead ("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles", "DefaultProfile")
$sKeyRoot = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" & $sDefaultProfile
Local $aRegKeys[1]
Local $aRegVals[1]
For $i = 1 To 2000
   Local $sKey = RegEnumKey($sKeyRoot, $i)
   If @error <> 0 Then ExitLoop
   _ArrayAdd($aRegKeys, $sKey)
Next
For $t = 1 to UBound($aRegKeys) - 1
   For $z = 1 To 2000
   Local $sValue = RegEnumVal($sKeyRoot & "\" & $aRegKeys[$t], $z)
   If @error <> 0 Then ExitLoop
   $xBin = RegRead($sKeyRoot & "\" & $aRegKeys[$t], $sValue)
   $sBinaryToString = BinaryToString(StringRegExpReplace($xBin, '\G(?i)[01][[:xdigit:]]|7f|(..)', '\1'))
   If StringInStr($sBinaryToString, "Test.pst") Then MsgBox(0,"",$sBinaryToString)
   Next
Next

It's like the PST file doesn't exist... but it does, and is added in Outlook. Any thoughts?

Share this post


Link to post
Share on other sites

Maybe this VB Script helps. I used it to create function _OL_PSTGet.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Thanks, Water. As an update, I've actually just found that this is a problem unique to Outlook 2013. When I run the same code on a computer with Outlook 2010, it reports back more than one PST. I'm not sure what to do now unfortunately. The code I posted above should parse every registry key in the profile, and it doesn't find the PST file with that name :( I wonder what Microsoft is doing differently in Outlook 2013...

Share this post


Link to post
Share on other sites

You could add a script based on the OutlookEX UDF into the logon script. This script then writes the information (user, computer, Outlook information) to a central location (file share, database) as soon as the user logs on.

If a user doesn't log on for quite some time then saving the information isn't needed any longer because the user is no longer active etc.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Hello. I re-up this topic. 

Is it possible to find, just the default pst associat to the default pop3 account ? 

In my case i have 3 pst files in Outlook and 2 pop3 account. 

 

Thx

Share this post


Link to post
Share on other sites
#include <OutlookEX.au3>
$oOL = _OL_Open()
$oNamespace = $oOL.GetNamespace()
$oStore = $oNamespace.DefaultStore
ConsoleWrite($oStore.FilePath)
_OL_Close($oOL)

I'm not 100% sure because I can't test at the moment.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites
#include <OutlookEX.au3>
$oOL = _OL_Open()
$oNamespace = $oOL.GetNamespace()
$oStore = $oNamespace.DefaultStore
ConsoleWrite($oStore.FilePath)
_OL_Close($oOL)

I'm not 100% sure because I can't test at the moment.

i didn't know this udf

for the code i have this error

(6) : ==> Variable must be of type "Object".:

Share this post


Link to post
Share on other sites

Will check tomorrow what causes the problem.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

How about this:

#include <OutlookEX.au3>
$oOL = _OL_Open()
$oNamespace = $oOL.GetNamespace("MAPI")
$oStore = $oNamespace.DefaultStore
ConsoleWrite($oStore.FilePath)
_OL_Close($oOL)

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

May as well throw this out there, most of the thread is old but a few people were asking how to get "all users" and such.

This works for 7/8/10 on Office 2007/2010/2013 and it logs the location with an option to copy them to the desktop under the profile name as usually I do this as part of a computer replacement so I can just take the copy of the archives and move them to the new computer with no fuss, and this lets you scan external connected hdds so you can extract the data off a dead computer by taking out the drive (often the case for me)

#Include <SecurityEx.au3>
#Include <Reg.au3>
#Include <Array.au3>
#Include <FileConstants.au3>
#Include <File.au3>
#RequireAdmin

$vDrive = InputBox("Drive Letter Selection", "Enter Driver Letter For Scan (Do Not Include Colon:)", "C")
If @Error Then Exit
$vOutlookVer = InputBox("Enter Outlook Version", "Outlook 2013 = 15" & @CRLF & "Outlook 2010 = 14" & @CRLF & "Outlook 2007 = 12")
If @Error Then Exit

$aUsers = _FileListToArray($vDrive & ":\Users", "*", $FLTA_FOLDERS)
For $i = 1 to $aUsers[0]

    If NOT StringInStr($aUsers[$i], "Administrator") AND NOT StringInStr($aUsers[$i], "Default") AND NOT StringInStr($aUsers[$i], "All Users") AND NOT StringInStr($aUsers[$i], "Public") Then
        _RegLoadHive($vDrive & ":\Users\" & $aUsers[$i] & "\ntuser.dat", "HKU\" & $aUsers[$i])
        For $i2 = 1 to 200
            If $vOutlookVer = 12 Then
                $sSubKey = RegEnumVal("HKU\" & $aUsers[$i] & "\Software\Microsoft\Office\" & $vOutlookVer & ".0\Outlook\Catalog", $i2)
                If @Error Then ExitLoop
                Else
                $sSubKey = RegEnumVal("HKU\" & $aUsers[$i] & "\Software\Microsoft\Office\" & $vOutlookVer & ".0\Outlook\Search\Catalog", $i2)
                If @Error Then ExitLoop
            EndIf

            If StringRegExp($sSubKey, ".*\.pst$") Then
                DirCreate(@DesktopDir & "\Outlook Archives\" & $aUsers[$i])
               _FileWriteLog(@DesktopDir & "\Outlook Archives\Outlook Archives.txt", $aUsers[$i] & " - " & $sSubKey)
               $sSubKeyMod = StringRegExpReplace($sSubKey, "^.", $vDrive)
               FileCopy($sSubKeyMod, @DesktopDir & "\Outlook Archives\" & $aUsers[$i] & "\" & $aUsers[$i] & "-" & $i2 & ".pst")
            EndIf

        Next
        _RegUnloadHive("HKU\" & $aUsers[$i])
    EndIf

    Next

    MsgBox(0, "BoCC Automation", "Copy of Outlook Archives Completed")

 

Share this post


Link to post
Share on other sites

How about this:

#include <OutlookEX.au3>
$oOL = _OL_Open()
$oNamespace = $oOL.GetNamespace("MAPI")
$oStore = $oNamespace.DefaultStore
ConsoleWrite($oStore.FilePath)
_OL_Close($oOL)

after the default pst, i try to do the same thing for the default mail adress.

when you write ".DefaultStore", ".filepath"... is it a com object ? or what is it ?

 

Share this post


Link to post
Share on other sites

$oOutlook.GetNameSpace("MAPI").CurrentUser

returns the current user as a Recipient Object. And yes, this are COM objects/properties/methods.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

$oOutlook.GetNameSpace("MAPI").CurrentUser

returns the current user as a Recipient Object. And yes, this are COM objects/properties/methods.

that's why i didn't understand :) 

i try to learn about the com object but for the moment i grope.

For the script something like this ?

#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()
Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Address
MsgBox(0, "Name", $sCurrentUser)
_OL_Close($oOutlook)

 

 

Edited by davzell13

Share this post


Link to post
Share on other sites

Exactly!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

thanks for help.

There are something else aside from the MSDN to help with the com object ? For example a tool for detect the object in a software (like Autoit windows info) ?

Share this post


Link to post
Share on other sites

For Microsoft products I would stick with MSDN. You get documentation plus examples to help you understand how it works.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...