Empty all mailboxes of single OU with a PowerShell command?
Hi,
Is it possible to empty all mailboxes of a single OU by a PowerShell command? If it is possible, what would be the command?
As a background information... My client has sold out an organizational unit. All emails and mailboxes are already transferred for a new company but the users still need their AD credentials to access some resources in my client's domain. Mailboxes are also
required to remain auto-forward and out of office information - at least for now. All of these users whose mailbox should be to empty are in same AD OU.
Best regards,
Toni
www.triuvare.fi
June 25th, 2012 9:37am
I would look at get-mailbox using the OrganizationalUnit switch to filter the results, then pipe | it to search-mailbox to delete the content
I am assuming Exchange 2010.
Free Windows Admin Tool Kit Click here and download it now
June 25th, 2012 10:57am
A_D was right, Please see below on how to do it
Step 1 :
Check the Below Article , Give Appropriate Permissions for the Admin
Cause By Default he wont have these permissions
http://careexchange.in/deleting-a-specific-email-from-entire-organization-in-exchange-2010-2/
Step 2:
Below command will Wipe of the Mailboxes in the particular OU
Get-Mailbox -OrganizationalUnit "Careexchange.in/RootOUName" | Search-Mailbox -SeachQuery "Subject:'*'" -DeleteContent
Satheshwaran Manoharan | Exchange 2003/2007/2010 | Blog:http://www.careexchange.in | Please mark it as an answer if it really helps you
June 25th, 2012 12:24pm
Hi,
Sorry, I forgot to inform you that this is for Exchange 2007 (latest SP). Can I still use the same command?
Best regards,
Toniwww.triuvare.fi
Free Windows Admin Tool Kit Click here and download it now
June 26th, 2012 1:05am
Hi,
Sorry, I forgot to inform you that this is for Exchange 2007 (latest SP). Can I still use the same command?
Best regards,
Toniwww.triuvare.fi
June 26th, 2012 1:13am
ha ha !!
Nope you cannot use it !!
This below link should help you
http://www.kevintaber.com/2009/06/09/search-for-and-delete-emails-in-exchange-2007-mailboxes-using-powershell/Satheshwaran Manoharan | Exchange 2003/2007/2010 | Blog:http://www.careexchange.in | Please mark it as an answer if it really helps you
Free Windows Admin Tool Kit Click here and download it now
June 26th, 2012 10:14am
ha ha !!
Nope you cannot use it !!
This below link should help you
http://www.kevintaber.com/2009/06/09/search-for-and-delete-emails-in-exchange-2007-mailboxes-using-powershell/Satheshwaran Manoharan | Exchange 2003/2007/2010 | Blog:http://www.careexchange.in | Please mark it as an answer if it really helps you
June 26th, 2012 10:21am
You can still use get-mailbox and the OrganizationalUnit filter however.
Free Windows Admin Tool Kit Click here and download it now
June 26th, 2012 10:30am
You can still use get-mailbox and the OrganizationalUnit filter however.
June 26th, 2012 10:37am
Hi,
Thanks for your help. I managed to empty the mailboxes with these instructions.
Best regards,
Toniwww.triuvare.fi
Free Windows Admin Tool Kit Click here and download it now
June 27th, 2012 7:51am
Hi,
Thanks for your help. I managed to empty the mailboxes with these instructions.
Best regards,
Toniwww.triuvare.fi
June 27th, 2012 7:58am