Fix Unrecognized SearchName and Purge Parameters in Exchange Online PowerShell
Question details
The user needs to resolve an issue where the SearchName and Purge parameters are no longer recognized when purging emails.

- Product
- Exchange Online PowerShell
- Device & OS
- not provided
- Scenario
- Using the ExchangeOnlineManagement PowerShell module to execute email purge commands with an administrative account.
- Observed behavior
- The command fails because the SearchName and Purge parameters are not recognized, even though they worked in previous executions.
Ensure that your ExchangeOnlineManagement PowerShell module is up to date and that you have the required eDiscovery or Compliance Administrator roles assigned in the Microsoft Purview compliance portal.
Use Search Action Identity Instead of SearchName Parameter
Replace the deprecated SearchName parameter with the exact search action identity to successfully execute the compliance search and purge actions.
Microsoft frequently updates the ExchangeOnlineManagement module, which can result in certain parameters like SearchName being deprecated or modified. To ensure your scripts continue to function properly, you must use the Identity parameter associated with the compliance search action.
Open your PowerShell terminal as an administrator and connect to the Exchange Online module using the Connect-ExchangeOnline cmdlet.
Type the command Get-ComplianceSearchAction and press Enter. This will output a list of all currently available search actions in your environment.
Run the command Get-ComplianceSearchAction -Identity "Your_Search_Name_Preview" | Format-List to view the detailed properties of your target search action. Replace "Your_Search_Name_Preview" with your actual case or search name.
Once you have verified the correct identity from the previous step, use that specific identity string in your New-ComplianceSearchAction command instead of relying on the SearchName parameter.

Document Your IT Workflows and PowerShell Scripts with WPS Office
While resolving Exchange Online and PowerShell issues requires technical backend troubleshooting, maintaining clear IT documentation doesn't have to be a hassle. WPS Office is a free, lightweight, and user-friendly alternative to Microsoft Office that ensures seamless migration and compatibility.
- 1. Download WPS Office: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install the application: Run the setup file and follow the on-screen instructions to quickly install the lightweight suite.
- 3. Create your IT documentation: Open WPS Writer to start drafting your PowerShell troubleshooting guides and compliance search policies with full MS Word compatibility.

Frequently Asked Questions
Why did the SearchName and Purge parameters stop working in my PowerShell script?
Microsoft continuously updates the ExchangeOnlineManagement module. Older parameters are often deprecated in favor of more secure or standardized cmdlets. Using the search action Identity is the current supported method.
What roles are required to run Get-ComplianceSearchAction?
You must be assigned the eDiscovery Manager or Compliance Administrator roles within the Microsoft Purview compliance portal to run these search and purge commands successfully.
How do I update my ExchangeOnlineManagement PowerShell module?
Open PowerShell as an administrator and run the command Update-Module -Name ExchangeOnlineManagement. This ensures you have the latest cmdlets and parameter sets installed.
Can I still hard-delete emails using compliance search actions?
Yes, but you must use the New-ComplianceSearchAction cmdlet with the correct Identity and the -Purge -PurgeType HardDelete parameters instead of the old SearchName method.




