$filter="{((((Company -eq 'XXXXXXXX') -and ((Title -eq 'Hauswirtschaft') -or (user.objectid -eq '2a424d65-88f1-49b5-87d8-2008c28e85b5')))) -and (-not(Name -like 'SystemMailbox{')) -and (-not(Name -like 'CAS_{')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'PublicFolderMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'AuditLogMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'AuxAuditLogMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'SupervisoryReviewPolicyMailbox')))}
When using
Get-Recipient -RecipientPreviewFilter $filter | ft displayname, company, department, title
Ist says
for recipient preview is neither a valid OPath filter nor a valid LDAP filter. Use the '-RecipientPreviewFilter' parameter with either an existing
OPath filter string or with a valid LDAP filter string.
+ CategoryInfo: InvalidArgument: (:) [Get-Recipient], ArgumentException
+ FullyQualifiedErrorId: [Server=AM6PR08MB3655,RequestId=8bbcdb0f-7d08-4939-ae05-300a9aa36b0c,TimeStamp=15.02.2022 17:11:16] [FailureCategory=Cmdlet-ArgumentException] 1B362B53,Microsoft.Recip.ExientTasks.Management
recipient
+ PSComputer name: outlook.office365.com
What is wrong with the filter?