I don't think this should be so difficult, but it is (for me anyway.) I just need to add an additional Exchange server to the recipient filter. Initially I had three listed, and it worked fine. This is the command i ran, and like i said, no issues...
set-dynamicdistributiongroup "Some Dynamic DL" {((((((((((((((ServerName -eq 'Server1') -or (ServerName -eq 'Server2'))) -or (ServerName -eq 'Server3'))) -and (-not(Name -like 'SystemMailbox{*')))) -and (-not(Name -like 'CAS_{*')))) -and (-not(Name -like 'SystemMailbox{*')))) -and (-not(Name -like 'CAS_{*')))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')))}
Now, when i add a fourth server, i get an error. All i'm doing is adding -or (ServerName -eq 'Server4'))) So, the new command looks like this:
set-dynamicdistributiongroup "Some Dynamic DL" {((((((((((((((ServerName -eq 'Server1') -or (ServerName -eq 'Server2'))) -or (ServerName -eq 'Server3'))) -or (ServerName -eq 'Server4'))) -and (-not(Name -like 'SystemMailbox{*')))) -and (-not(Name -like 'CAS_{*')))) -and (-not(Name -like 'SystemMailbox{*')))) -and (-not(Name -like 'CAS_{*')))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')))}
When i run the above command, i get this error:
<position> : Missing closing '}' in statement block.
+ CategoryInfo : ParserError: (CloseBraceToken:TokenId) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndCurlyBrace
Which statement block is it referring to?? I guess a '}' is missing, but I've no idea where it should go. Can anyone point me in the right direction?
Thanks in advance.