
Get all pst files set up in Outlook ?
Function GetPstFromProfil { $PSTFiles=$null $ol=New-Object -ComObject Outlook.Application $ns=$ol.GetNamespace('MAPI') $store=$ns.Session.Stores|Where-Object{$_.FilePath -match "pst$"} $store | Foreach-Object{ $pst=$_.FilePath If($PSTFiles -ne $null){ $PSTFiles+="|$pst" } If($PSTFiles -eq $null){ $PSTFiles=$pst } } $PSTFiles=$PSTFiles.split("|") return $PSTFiles }
Then you just have to call that function such as :
$pstfiles=GetPstFromProfil