Jump to content

PST File Location


ZacUSNYR
 Share

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!

Link to comment
Share on other sites

  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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?

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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...

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 2 years later...
#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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Will check tomorrow what causes the problem.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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")

 

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
Link to comment
Share on other sites

Exactly!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...