Solved

Script to recall message from all mailboxes in Exchange 2007-2010

Posted on 2011-03-15
8
2,196 Views
Last Modified: 2012-05-11
Hello Experts,

Can anyone help me to build an script to do

Given a DL, or distribution group in AD that contains multiple sub-DLs and users.

Given an Exchange server, or multiple Exchange/Databases

Delete a message for all users in that DL and /or exchange/database server with subject is Virus, and export deleted messages into another mailbox?

I have this pw shell command for a single user and works fine

Get-Mailbox xxxx | Export-Mailbox -SenderKeywords "xxxx@xxxxxx.com" -SubjectKeywords "Virus" -StartDate "12/07/2010 7:09:00" -EndDate "12/07/2010 7:11:00" -TargetMailbox xxxxxxxx -TargetFolder ConfidentalData -Deletecontent -confirm:$false

Please be aware I am not a programmer, please indicate as many details as you can

Thank you in advance
0
Comment
Question by:Jerry Seinfield
  • 4
  • 3
8 Comments
 
LVL 25

Expert Comment

by:Tony1044
ID: 35146581
I'm not sure about at a DL level, but for database, try the following:

Get-Mailbox -Database "SERVER\First Storage Group\Mailbox Database" | Export-Mailbox -SenderKeywords "xxxx@xxxxxx.com" -SubjectKeywords "Virus" -StartDate "12/07/2010 7:09:00" -EndDate "12/07/2010 7:11:00" -TargetMailbox xxxxxxxx -TargetFolder ConfidentalData -Deletecontent -confirm:$false

0
 

Author Comment

by:Jerry Seinfield
ID: 35146936
Thanks Tony,

What if I have 20 CCR cluster and each cluster has 5 databases?

Can you please buld the ps script for this?
0
 
LVL 25

Expert Comment

by:Tony1044
ID: 35147078
That would be a complex script to build - not 5 mins work I think.

You can do it against OU as you originally asked with the following:

Get-Mailbox -OrganizationalUnit Marketing

I don't know if that might be any easier?
0
 
LVL 12

Expert Comment

by:prashanthd
ID: 35147221
You can also run against each exchange server, just replace servrname with the Server name

Get-Mailbox -server servername | Export-Mailbox -SenderKeywords "xxxx@xxxxxx.com" -SubjectKeywords "Virus" -StartDate "12/07/2010 7:09:00" -EndDate "12/07/2010 7:11:00" -TargetMailbox xxxxxxxx -TargetFolder ConfidentalData -Deletecontent -confirm:$false
0
Promote certifications in your email signature

Has your company recently won an award or achieved a certification? They'll no doubt want to show it off. Email signature images used to promote certifications & awards can instantly establish credibility with a recipient and provide you with numerous benefits.

 

Author Comment

by:Jerry Seinfield
ID: 35147802
Hi Tony,

Thanks for the information.

Basically, I need to script recall messages from a DL that contains multiple sub-DLs and users.

Can you please build an script for me based on that information and powershell command I attached above?
0
 

Author Comment

by:Jerry Seinfield
ID: 35160330
Any updates Experts?

Can anyone provide me with the script to recall messages from a DL that contains multiple sub-DLs?
0
 
LVL 25

Accepted Solution

by:
Tony1044 earned 500 total points
ID: 35163812
I think running it against a server would be your best option

Otherwise you need to google recursive powershell scripts and sub DL - they're complex scripts.
0
 

Author Closing Comment

by:Jerry Seinfield
ID: 35193158
I was expecting another answer for the DL request
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
A brief introduction to what I consider to be the best editor for PowerShell.
how to add IIS SMTP to handle application/Scanner relays into office 365.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now