SOLVED

Exchange 2016 ComplianceSearch not work

%3CLINGO-SUB%20id%3D%22lingo-sub-3016395%22%20slang%3D%22en-US%22%3EExchange%202016%20ComplianceSearch%20not%20work%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3016395%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3Ehi%20everyone%2C%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CP%3EI%20want%20to%3CSTRONG%3E%20soft%20delete%3C%2FSTRONG%3E%20all%20email%20contents%20in%20multi%20mailboxes%20in%20bulk.%26nbsp%3B%26nbsp%3BNew-ComplianceSearchAction%20cmdlet%20seems%20could%20achieve%20it%2C%20but%20it%20just%20could%20delete%2010%20messages%20one%20time..%3C%2FP%3E%3CP%3Ei%20tested%20cmdlets%20below%2C%20but%20return%20results%20are%20zero.%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3ENew-ComplianceSearch%20-Name%20%22test%22%20-ExchangeLocation%20%22%3CUSER%20id%3D%22%22%3E%22%20%7C%20Start-ComplianceSearch%0A%0AGet-ComplianceSearch%20%7C%20FL%20name%2Citems%2Csize%2Cjobprogress%2Cstatus%0A%0ANew-ComplianceSearchAction%20-SearchName%20%22test%22%20-Purge%20-PurgeType%20SoftDelete%3C%2FUSER%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Snipaste_2021-11-30_09-18-09.jpg%22%20style%3D%22width%3A%20955px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F330246iD87E8461099B270C%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Snipaste_2021-11-30_09-18-09.jpg%22%20alt%3D%22Snipaste_2021-11-30_09-18-09.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3BCan%20you%20help%20me%20why%20search%20result%20is%20blank%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3016395%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3017015%22%20slang%3D%22en-US%22%3ERe%3A%20Exchange%202016%20ComplianceSearch%20not%20work%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3017015%22%20slang%3D%22en-US%22%3EWhy%20don't%20you%20just%20use%20good%20old%20Search-Mailbox%3F%3C%2FLINGO-BODY%3E
New Contributor
hi everyone,
 

I want to soft delete all email contents in multi mailboxes in bulk.  New-ComplianceSearchAction cmdlet seems could achieve it, but it just could delete 10 messages one time..

i tested cmdlets below, but return results are zero.

 

 

New-ComplianceSearch -Name "test" -ExchangeLocation "<user id>" | Start-ComplianceSearch

Get-ComplianceSearch | FL name,items,size,jobprogress,status

New-ComplianceSearchAction -SearchName "test" -Purge -PurgeType SoftDelete

 

 

Snipaste_2021-11-30_09-18-09.jpg

 Can you help me why search result is blank?

4 Replies
Why don't you just use good old Search-Mailbox?

@Vasil Michev  hi Vasil, because i dont want to hard delete message, in case someone needs  recover messages..

best response confirmed by thorrr7 (New Contributor)
Solution
If you have single-item recovery enabled, they won't be permanently deleted. Same if the mailbox is on hold. And you can always use the other switched to make a copy of the deleted content. Bets having to run the same thing 100x times, at least in my book :)

As to why you're not getting any results, I'm not sure. Try adding some generic query instead, although it *should* include the whole content of the mailbox when no keywords are provided...
single-item recovery enbaled works~
i tried add ContentMatchQuery parameter, but result is the same..