You're simply missing the quotes, i.e. use
(-not(RecipientTypeDetailsValue -eq "RoomMailbox"))
instead of
(-not(RecipientTypeDetailsValue -eq RoomMailbox))
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a DDL for allstaff set up that anyone that has any user with exchange mailbox. I would like to remove shared email boxes. I have seen a lot of PS commands although none of them seem to work. I am probably missing something very simple as I am not a good power shell user. I am basically a copy paste guy. Would anyone be able to help me with that final command
I have gotten up to
Get-Recipient -Filter (Get-DynamicDistributionGroup "allstaff").RecipientFilter
and that shows me the DDL
although this one throws off all types of errors
Set-DynamicDistributionGroup -identity {$DistroIdentity} -RecipientFilter {(-not(RecipientTypeDetailsValue -eq SharedMailbox)) -and (-not(RecipientTypeDetailsValue -eq RoomMailbox)) -and (-not(RecipientType -eq MailContact)) -and (-not(RecipientType -eq MailUniversalDistributionGroup)) -and (-not(RecipientTypeDetailsValue -eq EquipmentMailbox))}
I am assuming I am missing something simple but have no idea what that is.... If anyone wants to help me out I would appreciate it.
You're simply missing the quotes, i.e. use
(-not(RecipientTypeDetailsValue -eq "RoomMailbox"))
instead of
(-not(RecipientTypeDetailsValue -eq RoomMailbox))
Hi,@Stephen Schauble
Thanks for posting your question in the Microsoft Q&A forum.
I'm glad your problem was resolved, please let me summarise the cause of the error.
When using PowerShell commands, variables following parameters need to be in quotes.