SOLVED

create a new ediscovery search using PowerShell

%3CLINGO-SUB%20id%3D%22lingo-sub-2109098%22%20slang%3D%22en-US%22%3Ecreate%20a%20new%20ediscovery%20search%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2109098%22%20slang%3D%22en-US%22%3E%3CP%3EHow%20to%20create%20a%20new%20search%20using%20PowerShell%20script%20within%20the%20existing%20case%20under%20eDiscovery%20Core%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20have%20hundreds%20of%20user%20exchange%20email%20addresses%20need%20to%20add%20to%20a%20new%20search.%20I%20can%20open%20the%20eDiscovery%20Core%20case%26nbsp%3Bfrom%26nbsp%3BUI%20%3CA%20href%3D%22https%3A%2F%2Fcompliance.microsoft.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fcompliance.microsoft.com%3C%2FA%3E%20then%20eDiscovery-%26gt%3BCore%20to%20open%20a%20existing%20case.%20After%20that%20I%20need%20to%20create%20a%20new%20search%20and%20add%20hundreds%20of%20exchange%20email%20addresses%20as%20selected%20locations%20to%20this%20new%20search.%20It%20is%20very%20time%20consuming.%20How%20can%20I%20use%20PowerShell%20script%20to%20create%20a%20new%20search%20and%20then%20add%20email%20addresses%20to%20the%20search%3F%20There%20any%20guideline%20or%20reference%20to%20accomplish%20this%20task%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%2C%3CBR%20%2F%3EPeter%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2109098%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECompliance%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EeDiscovery%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2109142%22%20slang%3D%22en-US%22%3ERe%3A%20create%20a%20new%20ediscovery%20search%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2109142%22%20slang%3D%22en-US%22%3E%3CP%3EFinally%20I%20made%20it%20work.%20The%20following%20is%20the%20cmdlets%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%20color%3D%22%230000ff%22%3ENew-ComplianceSearch%3C%2FFONT%3E%20%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%20color%3D%22%23000080%22%3E-Name%3C%2FFONT%3E%20%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%20color%3D%22%238b0000%22%3E%22SearchName%22%3C%2FFONT%3E%20%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%20color%3D%22%23000080%22%3E-Case%3C%2FFONT%3E%20%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%20color%3D%22%238b0000%22%3E%22CaseName%22%3C%2FFONT%3E%20%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%20color%3D%22%23000080%22%3E-ExchangeLocation%3C%2FFONT%3E%20%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%20color%3D%22%23a82d00%22%3E%3CA%20href%3D%22mailto%3A%24John.doe%40somewhere.coms%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EJohn.doe%40somewhere.com%3C%2FA%3E%20%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2109105%22%20slang%3D%22en-US%22%3ERe%3A%20create%20a%20new%20ediscovery%20search%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2109105%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F907356%22%20target%3D%22_blank%22%3E%40px091%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20New-ComplianceSearch%20cmdlet%20creates%20a%20new%20content%20search.%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fexchange%2Fnew-compliancesearch%3Fview%3Dexchange-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fexchange%2Fnew-compliancesearch%3Fview%3Dexchange-ps%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOne%20way%20of%20approaching%20the%20issue%20is%20to%20create%20the%20search%20using%20the%20GUI%20to%20make%20sure%20that%20you%20have%20all%20the%20other%20settings%20right%20and%20then%20running%20the%20Set-ComplianceSearch%20cmdlet%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fexchange%2Fset-compliancesearch%3Fview%3Dexchange-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fexchange%2Fset-compliancesearch%3Fview%3Dexchange-ps%3C%2FA%3E%26nbsp%3Band%20pass%20the%20list%20of%20Exchange%20mailboxes%20in%20the%20AddExchangeLocation%20parameter.%20The%20best%20idea%20is%20to%20use%20distribution%20lists%20to%20specify%20the%20mailboxes%20you%20want%20to%20add.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAll%20covered%20in%20the%20Office%20365%20for%20IT%20Pros%20eBook%20if%20you%20need%20a%20guide.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

How to create a new search using PowerShell script within the existing case under eDiscovery Core?

 

We have hundreds of user exchange email addresses need to add to a new search. I can open the eDiscovery Core case from UI https://compliance.microsoft.com then eDiscovery->Core to open a existing case. After that I need to create a new search and add hundreds of exchange email addresses as selected locations to this new search. It is very time consuming. How can I use PowerShell script to create a new search and then add email addresses to the search? There any guideline or reference to accomplish this task? 

 

Thanks in advance,
Peter

2 Replies
Best Response confirmed by px091 (Contributor)
Solution

@px091 

 

The New-ComplianceSearch cmdlet creates a new content search. https://docs.microsoft.com/en-us/powershell/module/exchange/new-compliancesearch?view=exchange-ps

 

One way of approaching the issue is to create the search using the GUI to make sure that you have all the other settings right and then running the Set-ComplianceSearch cmdlet https://docs.microsoft.com/en-us/powershell/module/exchange/set-compliancesearch?view=exchange-ps and pass the list of Exchange mailboxes in the AddExchangeLocation parameter. The best idea is to use distribution lists to specify the mailboxes you want to add.

 

All covered in the Office 365 for IT Pros eBook if you need a guide.

Finally I made it work. The following is the cmdlets

 

New-ComplianceSearch -Name "SearchName" -Case "CaseName" -ExchangeLocation John.doe@somewhere.com