Script to load and upload pst file

ScienceMySon

Reputable
Jan 21, 2015
49
0
4,530
0
Hi guys,

Any powershell wizards here ?

A friend of mine is using Outlook 2010. We are searching for a script to mount and unmount just 1 pst file (An archive)

Anybody can help with this?
 

kerberos_20

Distinguished
mount:
Code:
$Outlook = new-object -com outlook.application 
$Namespace = $Outlook.getNamespace("MAPI")

$PSTtoAdd = "c:\test\pst.pst"

$namespace.AddStore($PSTtoAdd)
unmount:
Code:
$Outlook = new-object -com outlook.application 
$Namespace = $Outlook.getNamespace("MAPI")

$PSTtoDelete = "c:\test\pst.pst"
$PST = $namespace.Stores | ? {$_.FilePath -eq $PSTtoDelete}
$PSTRoot = $PST.GetRootFolder()

$PSTFolder = $namespace.Folders.Item($PSTRoot.Name)
$namespace.GetType().InvokeMember('RemoveStore',[System.Reflection.BindingFlags]::InvokeMethod,$null,$namespace,($PSTFolder))
 

Similar threads


ASK THE COMMUNITY

TRENDING THREADS