For outlook 2010 we had the outlook profiles set under:- HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows Messaging Subsystem\\Profiles
.
Similar location for outlook 2013 is:- HKCU\\Software\\Microsoft\\Office\\15.0\\Outlook\\Profiles
.
In my program, I first look for 2013 profiles, getting an exception I look for 2010 profile location.
But this would fail if outlook is downgraded to 2010. As the registry key for outlook 2013 would still be at same place.
Any suggestions on this. Probably, if I can first get the correct version of outlook installed and then search the right key rather than using the try....except....block?
Majorly I want to list all the pst files attached to Outlook.
There is a record of attached PSTs in the registry but it appears that it is more a record of PST files that are indexed by Outlook's search, so I'm not sure if clearing out the indexing cache would remove the entries from the registry or not at one point but here are two locations that I have used:
Office 2007
HKCU:\software\Microsoft\Office\12.0\Outlook\Catalog
Office 2013
HKCU:\software\Microsoft\Office\15.0\Outlook\Catalog
Also note that this seems to be a history of attached archives instead of a list of actively attached archives. To get at the actively attached archives the only method I had found was using the COM object (Outlook.Application) but this isn't very nice because initializing the COM object of course starts Outlook so if you are pulling information in the background it might upset end users.
That being said here is a little PowerShell script that will both dump the attached archives and search the registry for a history of attached archives and place the results on the desktop.
'****************************Currently attached archives' | Out-File
$Env:UserProfile\Desktop\ArchiveHistory.txt -append
#NOTE: This launches Outlook if it is not already running.
$Outlook = New-Object -Comobject Outlook.Application
$Namespace = $Outlook.GetNamespace('MAPI')
$Mailboxes = $Namespace.Stores | where {$_.ExchangeStoreType -eq 1} | Select-Object DisplayName
$AttachedArchives = $Namespace.Stores | where {$_.ExchangeStoreType -eq 3} | Select-Object DisplayName,FilePath
$MailBoxes | Out-File -FilePath $Env:UserProfile\Desktop\OutlookMailboxes.txt
$AttachedArchives | Out-File -FilePath $Env:UserProfile\Desktop\OutlookAttachedArchives.txt
'****************************Archive History for Office 2007' | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append
get-item HKCU:\software\Microsoft\Office\12.0\Outlook\Catalog | select -expandProperty property | where {$_ -match '.pst$'} | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt
'****************************Archive History for Office 2010' | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append
get-item HKCU:\software\Microsoft\Office\14.0\Outlook\Catalog | select -expandProperty property | where {$_ -match '.pst$'} | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt
'****************************Archive History for Office 2013' | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append
get-item HKCU:\software\Microsoft\Office\15.0\Outlook\Search\Catalog | select -expandProperty property | where {$_ -match '.pst$'} | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append
'****************************Archive History for Office 2016' | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append
get-item HKCU:\software\Microsoft\Office\16.0\Outlook\Search\Catalog | select -expandProperty property | where {$_ -match '.pst$'} | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append