Fix Exchange Online Management Scope Filters with CustomAttribute1
Question details
The user needs to resolve an error occurring when running the New-ManagementScope PowerShell command in Exchange Online, specifically related to comparing Application IDs in CustomAttribute1.

- Product
- Microsoft Exchange Online
- Device & OS
- not provided
- Scenario
- Creating a new management scope using PowerShell to filter recipients based on specific Application ID values.
- Observed behavior
- The New-ManagementScope command fails to execute properly because the recipient restriction filter incorrectly compares the Application ID values stored in CustomAttribute1.
Ensure you are connected to the Exchange Online PowerShell module with an account that has Organization Management or Role Management permissions.
Verify OPATH Syntax and Test the Filter
Validate your OPATH filter syntax using the Get-Recipient cmdlet before applying it to the management scope to ensure proper string formatting and execution.
Exchange Online requires precise OPATH syntax for recipient filters. A missing quote, incorrect operator, or malformed string will cause the New-ManagementScope command to fail.
Examine your complete New-ManagementScope command. Ensure that the RecipientRestrictionFilter parameter uses correct OPATH operators like '-eq' and that the string values compared against CustomAttribute1 are enclosed in correct single quotes.
Run the command 'Get-Recipient -RecipientPreviewFilter "<Your Filter String>"' in your PowerShell session. This simulates the filter without modifying your environment.
Once the Get-Recipient command successfully returns the expected user list without throwing an error, copy the exact filter string into your New-ManagementScope command and execute it.

Consult the Exchange Online and PowerShell Community
Engage with technical specialists in Microsoft forums to debug highly complex or nested filter scripts that continue to fail.
Experience Lightweight Productivity with WPS Office
While resolving Exchange Online and PowerShell backend issues requires specialized technical troubleshooting, your daily document management shouldn't be complicated. WPS Office provides a lightweight, highly compatible alternative to Microsoft Office, letting you focus on productivity rather than software configuration.
- 1. Download the software: Visit the official WPS Office website and download the free installer package for your operating system.
- 2. Install WPS Office: Run the lightweight installer to quickly set up the Word, Excel, PowerPoint, and PDF toolset on your device.
- 3. Open your files: Directly open your existing Microsoft Office documents and continue your work with perfect formatting compatibility.

Frequently Asked Questions
What is CustomAttribute1 used for in Exchange Online?
CustomAttribute1 is one of fifteen customizable extension attributes available in Exchange Online. Administrators often use it to store unique metadata, such as Application IDs, department codes, or employee types, which can then be used to filter dynamic distribution groups, address lists, and management scopes.
Why am I getting a syntax error with New-ManagementScope?
Syntax errors in New-ManagementScope typically occur when the RecipientRestrictionFilter parameter contains invalid OPATH syntax. Common mistakes include using standard mathematical operators (like '=' instead of '-eq'), missing single quotes around string values, or improper bracket placement.
How can I preview which users are affected by my recipient filter?
Before committing a filter to a management scope, you can use the Get-Recipient cmdlet combined with the -RecipientPreviewFilter parameter. By passing your filter string to this command, Exchange will return a list of all mailbox objects that match the criteria, allowing you to verify accuracy.




