Solved

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

Posted on 2011-03-15
8
2,234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 26

Expert Comment

by:Tony Johncock
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 26

Expert Comment

by:Tony Johncock
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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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
 

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 26

Accepted Solution

by:
Tony Johncock 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…

738 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