Outlook PST Files

I ran into a situation where I couldn’t find a user’s pst file and I had to do it remotely, I couldn’t screen connect. POWERSHELL TO THE RESCUE !

Here is a little script you can put in a toolbox that will find all PST files in use. It searches the registry for all users on the machine and pulls their pst location. Since it starts searching at the Root Office OU Key it should work for all versions of office too.

New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS -ErrorAction SilentlyContinue

Write-Host = "Checking HKU accounts for unique PST locations..."

$HKUserList = get-childitem -Path HKU: | Select-Object -ExpandProperty Name
ForEach ($HKUser in $HKUserList) {
    $PSTFind = Get-ChildItem -Path HKU:\$HKUser\Software\Microsoft\Office\ -Recurse -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Property | Where-Object -FilterScript {$_ -like "*.pst"}
    ForEach ($PST in $PSTFind) {
        Write-Host "PST found at '$PST'..."
Write-Host "."
Write-Host "DONE ! PST Files have been Found." -ForegroundColor Yellow