Sign in to follow this  
Followers 0
ViciousXUSMC

Find Outlook Archive Location All Users

4 posts in this topic

Doing some PC replacements for multi-user computers, one of the problems I run into is Outlook Archives.  Each user may have some hidden away in the default AppData location, others are a bit smarter and put them on a network location.

I think its time to come up with a script I can run as an admin on the computer that will compile the PST locations of all users to a file for me so I can make sure to not miss those in a PC swap.

I would most likely enumerate the registry, but it appears there is a COM object that I can perhaps use as well (though not sure if that would be current user only, or can be implemented for an "all user" situation) before I go on the hunt any ideas or already created scripts for this function?

Share this post


Link to post
Share on other sites



Hi,

This sounds pretty simple unless there is something I am missing. You can use DriveGetDrive to list the drives connected the the user's computer. Then use _FileListToArrayRec to list only .PST files. You can save the person's login name (and computer name to help identify in case they log into multiple computers) and the list of returned items. Save it to a network location. I have done such a thing when I needed to get the serial numbers, model numbers, etc off everyone's computers. By the way, I have noticed that FileListToArrayRec is much faster than Windows' built in search function.

Hopefully, this info can get you started. If you run into any trouble, let us know.


RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yeah I could search like that  (probably would have used powershell with get-childitem) but I am afraid of the speed of searching an entire drive when the data I need should be already on the computer.  Also if on a network storage location searching the C: would not help.

I read (and though I had previously verified) that HKCU:\software\Microsoft\Office\15.0\Outlook\Catalog had a history of archives attached.

When I just looked at my computer that was not the case but a similar path did.

HKCU\Software\Microsoft\Office\14.0\Outlook\Search\Catalog

Obviously the 14/15 etc would change based on office version.  So I need to go look at some more computers to verify the information is there, if it is this is the script I have so far.

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

$aUsers = _FileListToArray("C:\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("C:\Users\" & $aUsers[$i] & "\ntuser.dat", "HKU\" & $aUsers[$i])
        For $i2 = 1 to 200
            $sSubKey = RegEnumVal("HKU\" & $aUsers[$i] & "\Software\Microsoft\Office\14.0\Outlook\Search\Catalog", $i2)
            If @Error Then ExitLoop
            _FileWriteLog(@DesktopDir & "\Outlook Archives.txt", $aUsers[$i] & " - " & $sSubKey)
        Next
        _RegUnloadHive("HKU\" & $aUsers[$i])
    EndIf

Next

 

Edited by ViciousXUSMC

Share this post


Link to post
Share on other sites

Well after looking at a few computers looks like that registry path works well, so I modified to let me pick the Outlook version in use and also go ahead and copy those .pst files to a single location so that I do not need to go manually hunt them down.  Just tried it and seems to be working perfectly.

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

$vOutlookVer = InputBox("Enter Outlook Version", "Outlook 2013 = 15" & @CRLF & "Outlook 2010 = 14" & @CRLF & "Outlook 2007 = 12")

$aUsers = _FileListToArray("C:\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("C:\Users\" & $aUsers[$i] & "\ntuser.dat", "HKU\" & $aUsers[$i])
        For $i2 = 1 to 200
            $sSubKey = RegEnumVal("HKU\" & $aUsers[$i] & "\Software\Microsoft\Office\" & $vOutlookVer & ".0\Outlook\Search\Catalog", $i2)
            If @Error Then ExitLoop
            If StringRegExp($sSubKey, ".*\.pst$") Then
                DirCreate(@DesktopDir & "\Outlook Archives\" & $aUsers[$i])
               _FileWriteLog(@DesktopDir & "\Outlook Archives\Outlook Archives.txt", $aUsers[$i] & " - " & $sSubKey)
               FileCopy($sSubKey, @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

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  
Followers 0

  • Similar Content

    • ur
      By ur
      I wrote a macro for outlook to send an email.
      Till yesterday it worked, don't know why it is not working today
      I am getting below error when I ran the macro.
       

    • ur
      By ur
      Through below script I am able to send mail with the Outlook installed in my machine.
       
      But I am getting below prompt whenever I ran this script,by Outlook.
      Can anyone suggest how to suppress this.
      #include <MsgBoxConstants.au3> ; Counting the number of open shell windows Local $oShell = ObjCreate("Outlook.Application") ; Get the Windows Shell Object If IsObj($oShell) Then $Mail = $oShell.CreateItem(0) $Mail.To = "dponnada@erwin.com" $Mail.Subject = "Action" $Mail.Body ="Pay rise please" $Mail.Send() EndIf  

    • visler
      By visler
      Hi all

      I been using autoit some years ago and needed a tool for changing various in outlook so i found autoit again and i allready succeed in some of this, but i cant find and delete an appointment.
      I have found this example and the creation is ok (after i changed $oOL/$oOutlook typo)
      Https://www.autoitscript.com/wiki/OutlookEX_UDF_-_Meeting_Item
      But i cant get the delete part to work and i keep on getting "not found" and an empty array (screen shoot of _ArrayDisplay attached)
      Please can someone tell me what i am missing, i have been searching and trying various but stil i have no luck in finding any items.

      I am using outloook 2013 and office365. I have been able to send mails and create appointment, so i guess my problem is not due to the use off office365.

       

    • Dent
      By Dent
      Hi, I have written the following code and although the email is successfully created from a template it just sits in my draft folder without being sent and I can't figure out why?
      #include <OutlookEX.au3> $Email = "test@test.com" $Outlook = _OL_Open() $olItem = _OL_ItemCreate($Outlook, 1, "", "Feedback.oft", "To=" & $Email) _OL_ItemSend($Outlook, $olItem, Default) _OL_Close($Outlook) Place Feedback.oft in the same folder as the script for it to run. Oh and you have to have a working Outlook installation and mail profile set up
      SOLVED changed the 1 to $olMailItem
       
      Feedback.oft
    • Revelation343
      By Revelation343
      Purpose of script: To send emails in Outlook based on data in an excel spreadsheet. From: fields are entered for purposes of sending on behalf of (delegate), copies A2 cell from excel for To: field, Subject field is a static value and entered, returns to excel spreadsheet to read A1 and copy the first name and insert into the body of a template at an insertion point. The From, and the body of the email change based on region, so currently I have 6 different scripts that do essentially the same thing with some minor changes and want to consolidate into one script to save time.
      Question:
      To expedite the process of this and cut down on the amount of scripts, 6 in total I use daily, is it possible for me to somehow add the region to column C in excel, have autoit read column C values per row, and then decide which function, within a master script, to execute and loop this until there is no value in column C field?
      Example spreadsheet:
      Rob | rob@annuity.com |Midwest
      Annie | annie@agency.com | Midwest
      Kyle | kyle@agency.com | MidAtlantic
      Rick | rick@megasales.com | MidAtlantic
      Blank | Blank | Blank |
      Example execution:
      Run Birthday.au3, execute loop part through hotkey
      Reads row 1, C1, value is Midwest, calls Midwest(), script runs as Midwest Birthday.au3 does currently
      Reads row 2, C2, value is Midwest, calls Midwest(), script runs as Midwest Birthday.au3 does currently
      Reads row 3, C3, value is MidAtlantic, calls MidAtlantic(), script runs as MidAtlantic Birthday.au3 currently
      Reads row 4, C4, value is MidAtlantic, calls MidAtlantic(), script runs as MidAtlantic Birthday.au3 currently
      Reads row 5, C5, value is null or blank, ends script through Exit
       
      Everything I have coded in my time in AutoIt has been based mostly on mouse based movements and I don't have variable programming knowledge so I feel like I'm close to understanding how to do this, but the reading/storing variables part is beyond my current skill set. Help is appreciated.
      Mail Merges don't work as delegated in Outlook 07, for those that might be questioning why I just don't do that.
       
      MidAtlantic Birthday.au3
      Midwest Birthday.au3