Get all pst files set up in Outlook ?

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

Comments are closed.
How to whitelist website on AdBlocker?

How to whitelist website on AdBlocker?

  1. 1 Click on the AdBlock Plus icon on the top right corner of your browser
  2. 2 Click on "Enabled on this site" from the AdBlock Plus option
  3. 3 Refresh the page and start browsing the site