Link to home
Start Free TrialLog in
Avatar of Joe_Budden
Joe_Budden

asked on

Results file for Exch Powershell script

Hi

I am using the following script to delete content from a mailbox:

Get-Mailbox -Identity User1 | Export-Mailbox -SubjectKeywords “Deletethis” -StartDate “12/12/2011" -DeleteContent
 | out-file c:\results.log

I actually have several mailboxes that I need to do this on, so am going to use this:

Get-content c:\userlist.txt | ForEach-Object {Export-Mailbox -Identity $_ -SubjectKeywords “Deletethis” -StartDate “12/12/2011" -DeleteContent}

What I'd like to be able to have is a result file at the end of the script that lists the mailboxes that the script worked on and how many messages were deleted.

Does anyone know how this is possible?
Avatar of sunnyc7
sunnyc7
Flag of United States of America image

Joe
a) What version of Exchange Server are you running ? The cmdlet you use will depend on that
Export-Mailbox - 2007
New-MailboxExportRequest 2010

Also please take a look at this.
http://blogs.technet.com/b/sbs/archive/2009/01/13/sbs-2008-how-to-export-and-import-mailboxes-to-and-from-pst.aspx
Avatar of Joe_Budden
Joe_Budden

ASKER

We are running Exchange 2007. But it's more how we get the output log file that I am interested really.
SOLUTION
Avatar of sunnyc7
sunnyc7
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial