New-MailboxSearch not recognized
been trying to remove a message from all of our students mailboxes which one of the darlins sent out. where on sp1 2010 exchange but I cant seem to get the code to work and my heads hurting now with Power shell. Trying to do it for the body of the email too.
Get-MailboxDatabase -identity "Student Database" | Search-Mailbox -SearchQuery 'Subject:"ENTER TEXT HERE"' -DeleteContent
Well I did this on 2007 but presumably the cmdlets will work the same in 2010.
Learnt the Hard Way: How to Forcibly Remove Messages in Exchange - Blogs - EduGeek.net
That will ask for a target mailbox and folder so give it your own or an itsupport mailbox and it copies the content over; that way you can see who has read the message or not (if you can be bothered to dig through them all!)Code:get-mailbox -Database Student | Export-Mailbox -SubjectKeywords "SUBJECT QUERY HERE" -StartDate "DD/MM/YYYY" -DeleteContent
EDIT to say I'm guessing the name of your student database there, obviously. Replace the word "student" with whatever is appropriate.
I get the error The term 'Export-Mailbox' is not recognized as the name of a cmdlet, I think they made changes in 2010 sp1.
Do you have the Mailbox Import Export RBAC role assigned to the user account you using? If not, that could be why it isn't working.
Code:New-ManagementRoleAssignment –Role "Mailbox Import Export" -User Administrator
Last edited by Arthur; 13th March 2012 at 04:29 PM.
The command is now New-ExportMailboxRequest, as well as ensuring you have the role above^
New-MailboxExportRequest was just for exporting mailboxes to PSTs? Surely it's the Search-Mailbox cmdlet you need?
Code:Search-Mailbox -Identity JaneDoe -SearchQuery "Subject:'free iPad'" -DoNotIncludeArchive -SearchDumpster:$false -DeleteContent -ForceCode:Get-Mailbox -ResultSize Unlimited | Search-Mailbox -SearchQuery 'from:email@example.com' -DeleteContent -Force
There are currently 1 users browsing this thread. (0 members and 1 guests)