question

AustinSundar-2506 avatar image
0 Votes"
AustinSundar-2506 asked AustinSundar-2506 commented

New DDL creation

i am trying to create a new DL and it shows error . could anyone please help?


 $DDL = “”
 $Alias = “”
 $OU = “”
 New-DynamicDistributionGroup -Name $DDL -Alias $Alias -OrganizationalUnit $OU -RecipientFilter ((RecipientTypeDetails -eq 'UserMailbox') -and (Office -eq 'Decentralized - Chile, Santiago') -or (Office -eq 'Decentralized - Farmingdale, NY') -or (Office -eq 'Decentralized - Peru, Lima') -or (Office -eq 'Decentralized - Philadelphia') -or (Office -eq 'Decentralized - San Antonio') -or (Office -eq 'Decentralized - San Diego') -or (Office -eq 'Decentralized - Sugar Land') -or (Office -eq 'Decentralized - San Francisco') -or (Office -like 'Decentralized - US,*') -or (Office -like 'Decentralized - Chile, Santiago') -or (Office -like 'Decentralized - Chile, Santiago') -and (-not(Office -like ‘Decentralized - Brazil, Sao Paulo’)) -and (-not(Office -like ‘Decentralized - Colombia, Bogota’)) -and (-not(Office -like ‘Decentralized - Peru, Lima’)) -and (-not(Office -like ‘Decentralized - Mexico, Mexico City’)) -and (-not(Office -like ‘Decentralized - Argentina, Buenos Aires’)) -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’)))







office-exchange-server-administration
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Whats the error?

0 Votes 0 ·

this is the error
RecipientTypeDetails : The term 'RecipientTypeDetails' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:4 char:98

0 Votes 0 ·

Please post what exact steps you are doing and how you are connecting to Exchange with powershell.

0 Votes 0 ·
Show more comments
KyleXu-MSFT avatar image
0 Votes"
KyleXu-MSFT answered AustinSundar-2506 commented

@AustinSundar-2506

There missing “()” in your command, the filter before and after "-and" should be independent, you need contain all "-or" in a "()", because they are continuously:

 New-DynamicDistributionGroup -Name DDL2 -Alias DDL2 -RecipientFilter “(RecipientType -eq 'UserMailbox') -and ((Office -eq 'Decentralized - Chile, Santiago') -or (Office -eq 'Decentralized - Farmingdale, NY'))”

103957-qa-kyle-09-54-15.png

As AndyDavid said, you don't need to add the red part below into your command, they are added automatically:
103984-qa-kyle-09-52-58.png

Here is the result of this command, it doesn't contain the "Bogota":
103975-qa-kyle-10-07-27.png

If you cannot see screenshots clearly, you can right click on it and choose "Open image in new tab"


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AustinSundar-2506

I am writing here to confirm with you any update about this thread now?
If the above suggestion helps, please be free to mark it as an answer for helping more people.

0 Votes 0 ·

@KyleXu-MSFT thanks very much for your support . it helped me to solve the issue

0 Votes 0 ·
AndyDavid avatar image
0 Votes"
AndyDavid answered AustinSundar-2506 commented

Its not supported to Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn

After you open the remote powershell session on the Exchange Server, you typically simply need to run something like:

https://docs.microsoft.com/en-us/powershell/module/exchange/new-dynamicdistributiongroup?view=exchange-ps

 New-DynamicDistributionGroup -Name "Marketing Group" -IncludedRecipients "MailboxUsers,MailContacts" -ConditionalDepartment "Marketing","Sales"

Not sure why you are running all that above

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

i am trying to create separate DDL for homebased US users. since we have office across the globe i am using that filter
the office location field is also not same for all homebased employees. so i mentioned each office location

0 Votes 0 ·
AndyDavid avatar image
0 Votes"
AndyDavid answered

Simplify it:

Example

 New-DynamicDistributionGroup -Name "Group" -RecipientFilter "(RecipientType -eq 'UserMailbox') -and (Office -eq 'Decentralized - Chile, Santiago')" 

etc...

Start from there and add the other offices to the filter.

Don't add all that other stuff. It will be added automatically.

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’)))


Stick to the actual filters for the malboxes themselves.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.