How can I back up Outlook folder contents using powershell?

rated by 0 users
This post has 0 Replies | 1 Follower

Top 50 Contributor
Posts 69
jwhite Posted: 04-12-2011 7:36 AM

I found a script using Technet and Google.

$outlook = New-Object -comObject Outlook.Application 

$olJunk = $outlook.Session.GetDefaultFolder(23)  

$($olJunk.Items) | %{$_.Delete()} 

It turns out it does actually empty the junk mail folder.  I guess each default folder is assigned a numerical value.

What I'm looking for is a way to actually backup the folder contents before the delete.  In a sense doing the equivalent of a pst backup using powershell.  I'm hoping I can get powershell to select the folder and mimic the action of a Import/Export to .pst.

I don't even know if this is possible, anyone have any ideas?  Thanks...

Page 1 of 1 (1 items) | RSS
Copyright 2012 PowerShell.com. All rights reserved.