Searching Exchange 2007 for a Specific Attachment
Hi,I've been trying to find the correct powershell command for Searching for a specific Attachment....For example: Wanting to search all users that have an attachment called "Big Party" and dump all users returned into the Admin mailbox under the Folder Attachments.get-user | Export-Mailbox -TargetMailbox admin -TargetFolder attachments -AttachmentFilenames "Big Party"Now I don't have a test environment to test this in but I'm guessing something like this will cause some impact as it will search all mailboxes and there are 10K plus.Does the command look ok and will it do what i want it to ?RegardsBrett
March 9th, 2010 2:02am

it should be get-mailbox | Export-Mailbox -AttachmentFilenames "*Big Party*" –TargetMailbox Administrator –TargetFolder 'MyData'Full time IT consultant since 1998 mainly on Exchange\ISA\AD MCSE NT4.0,2000/2003, CCNA MCITP: Enterprise Messaging Administrator 2007/2010 MCT since 2001
Free Windows Admin Tool Kit Click here and download it now
March 9th, 2010 2:09am

One more thing to minimize the effect you can run it base on Exchange Servers or mailbox database It would become get-mailbox -server Exchange | Export-Mailbox -AttachmentFilenames "*Big Party*" –TargetMailbox Administrator –TargetFolder 'MyData' or get-mailbox -Database DB1 | Export-Mailbox -AttachmentFilenames "*Big Party*" –TargetMailbox Administrator –TargetFolder 'MyData' If you want to delete the file from user's mailboxes you will need to add -DeleteContentFull time IT consultant since 1998 mainly on Exchange\ISA\AD MCSE NT4.0,2000/2003, CCNA MCITP: Enterprise Messaging Administrator 2007/2010 MCT since 2001
March 9th, 2010 2:19am

The above command is good. Please make sure your accound has full access on the mailbox1. Command to give full mailbox access Get-Mailboxdatabase | Add-AdPermission -User "Username" -AccessRights GenericAll2.Export mails i go with IADkget-mailbox -server Exchange | Export-Mailbox -AttachmentFilenames "*Big Party*" –TargetMailbox Administrator –TargetFolder 'MyData'orget-mailbox -Database DB1 | Export-Mailbox -AttachmentFilenames "*Big Party*" –TargetMailbox Administrator –TargetFolder 'MyData'Hope this helps:)
Free Windows Admin Tool Kit Click here and download it now
March 9th, 2010 4:36am

Now this command only copy's msgs right ?The powershell console is saying it is moving msgs which would be a bad thing....
March 9th, 2010 5:10am

it just copies. if you want to delete them you need to add -DeleteContent switch with Export-Mailbox
Free Windows Admin Tool Kit Click here and download it now
March 9th, 2010 7:39pm

Ok we ran this command last night:get-mailbox -Database DB1 | Export-Mailbox -AttachmentFilenames "*Big Party*" –TargetMailbox Administrator –TargetFolder 'MyData'It started copying all sorts of emails into the Mydata restored folders for all sorts of users...So it doesn't seem to work correctly.... It definatley wasn't copying only msgs that had attachments with the word Big Party in it..Any ideas ?
March 9th, 2010 9:42pm

This is really funny this is the second thread reporting this looks like a bug somewhere what SP are you runningFull time IT consultant since 1998 mainly on Exchange\ISA\AD MCSE NT4.0,2000/2003, CCNA MCITP: Enterprise Messaging Administrator 2007/2010 MCT since 2001
Free Windows Admin Tool Kit Click here and download it now
March 9th, 2010 11:17pm

2003 Sp2 with upto date Feb Hotfixes and Exchange 2007 Sp1 Rollup 8.Cheers
March 9th, 2010 11:42pm

Can you upgrade to SP2 Rollup 2 as a startFull time IT consultant since 1998 mainly on Exchange\ISA\AD MCSE NT4.0,2000/2003, CCNA MCITP: Enterprise Messaging Administrator 2007/2010 MCT since 2001
Free Windows Admin Tool Kit Click here and download it now
March 10th, 2010 12:06am

SP2 goes on this weekend and R2 a few weeks later if all goes well with SP2..
March 10th, 2010 12:48am

Please report if things get fixed with SP2 thanksFull time IT consultant since 1998 mainly on Exchange\ISA\AD MCSE NT4.0,2000/2003, CCNA MCITP: Enterprise Messaging Administrator 2007/2010 MCT since 2001
Free Windows Admin Tool Kit Click here and download it now
March 10th, 2010 8:55am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics